SchultzGames
Para tirar dúvidas, crie um tópico especifico na área "Dúvidas em Geral" e aguarde ser respondido. Evite comentar em tópicos não relacionados a sua dúvida :D
TÓPICOS RECENTES:
Tópico:
Postado em:
Postado por:
Erro ao compilar para IOS
[Devlog] Lost in the world 14/11
[Duvida] Bug ao usar Vector3.Lerp Objeto é teleportado na lata
Jogo 2D unity - trocar sprite ao apertar botão
sombras para jogos mobile
Unity - Deslizar Para Rotacionar o 'Personagem'
Discord para desenvolvimento de jogos
Bug/Erro da unity?
[TUTORIAL] Controle 3ª pessoa com animações mecânicas (root motion)
rotação no exio z
[TUTORIAL] Banco de dados || MySQL
(UNITY) Erro ao compilar a Build Android
Unity + MySQL
Erro de Prefab quando realiza o Build de um projeto 3D
Em busca de um modelador 3D para plataforma educacional (Já ganhamos apoio de faculdades)
[TUTORIAL] Unity 5 - Sistema Completo de PORTAS E CHAVES
Drop Shadows
[RESOLVIDO]Como aplicar textura alpha na unity
Unity 3D - Desenhos Com Física(Download Projeto)
Como mudar o CONTROLLER do ANIMATOR
Como criar um poligono dinamicamente?
erro no unity
movimento de uma nave
Instantiate
Problema ao rotacionar valores negativos.
Calcular hora ?
Novo estilo de estourar blocos, baixe meu jogo pessoal ... conto com a ajuda de vocês!!!
Jogo que fiz para uma Jam da minha faculdade FATEC Ourinhos.
Não consigo o Android SDK!!
[RESOLVIDO] Como faço para depois de determinado tempo acontecer algo?
CRASH AO ENTRAR NA CENA UNITY
estou procurando um bom tutorial de IA Basica
Erro ao colocar script no botão
Novo jogo em desenvolvimento, 13º andar
Text Dinâmico no botão
Sistema Pdv, Mercado, Padaria, Conveniência, Lojas Em Geral - C# VISUAL STUDIO
[TUTORIAL] - Script de lanterna pra seu jogo de terror e outros...
[RESOLVIDO] Unity - Reproduzir Videos Do Blender No Unity
Ordem de fases
[RESOLVIDO] Tenho algum erro de simbolo no script do carro o que poderia ser?
[RESOLVIDO] Dúvida. Detectar colisões nas instâncias
erro na minha IA
[TUTORIAL] While, como funciona?
Mostrar a contagem em 10K e 100M
[TUTORIAL] AI Enemy 2.0 + animações ( Jogos de terror )
Cores nos materiais sem criar material
Poderia modelar um personagem cartoon para meu projeto
Como coloco modo de criação de personagem?
[Ajuda] Assets
RayCasting + Disparo Um Bom Tipo De Video Aula.
Ajuda de Blender para Unity
Procuro Equipe Para Criação de Jogo [PAGO]
[____TÓPICO LIVRE____] FALE O QUE QUISER (Parte 2)
[RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
[TUTORIAL] Criar Analógico Virtual UI Para Mobile.
[TUTORIAL] Acessar nomes de arquivos diretamente da pasta
Objeto dentro do player nao ta rotacioando
[TUTORIAL] MENU PRINCIPAL - UNITY 5 (5.3 ou superior) (Com UI)
Array de prefabs
screenshot
instancia item aleatorio em varias posicoes
[TUTORIAL] Mira que fica se movendo (ocilando,tremendo,etc)
Getcomponent de C# para java
Curso barato de C#
Unity - Modelo 3D em Menu 2D
[RESOLVIDO] Camera Estilo Showroom
A um mês com unity bugado sem resposta
[GameJam] Competição organizada pela BitCodeStudios
Pegar strings de "duas em duas"
criar um piano no unity
Movimentação
Instanciar objeto onde cricar com mouse ou touch
Dúvida Sistema de Energia para jogo android
[RESOLVIDO] Inimigo patrulhando constantemente estilo mario
BUG UNITY 3D ROSA A SCENE E GAME
Dúvida. Colliders no Unity3D
Pq a grama do Unity é tao pesada?
Alguem cria uma conta na playstore pra mim? :(
Capture Panorama?
Artistas 3D e Programadores Unity3D (Remunerado)
Input Get Key
SCHULTZ Jogo de terror
(Erro) IndexOutOfRangeException:Array index is out of range
EU QUERIA COLOCAR ANUNCIOS NO MEU JOGO NA MUDANÇA DE CENAS MAS NÃO ACHO UM JEITO
Unity - Duvida Sobre a JDK Que Vocês Usam
[RESOLVIDO] Adicionar Botoes em controle mobile
admob recompensa
Unity - Duvida Sobre Atualizar
Unity Admob GDPR (como implementar ?)
Timer para mudar de câmera
The Pyramid Demo Atualizado
[____ENQUETE____] Eleições para presidente 2018 (2º turno)
Mudando cor do texto...
como dminuir o lag no meu unity 5
[JOGO MOBILE] Defeat the Illuminatis
Como chamar animação sem passar por outro parâmetros?
[TUTORIAL] Unity 5 - Botão contínuo usando UI (Manter pressionado)
unity - erro ao buildar
Meus ints não aparecem no Inspector, serializable não funciona
Hoje à(s) 11:28 am
Hoje à(s) 11:23 am
Hoje à(s) 9:31 am
Hoje à(s) 5:23 am
Hoje à(s) 1:23 am
Ontem à(s) 11:15 pm
Ontem à(s) 4:59 pm
Ontem à(s) 4:47 pm
Ontem à(s) 3:23 pm
Ontem à(s) 2:13 pm
Qua Nov 14, 2018 5:47 pm
Qua Nov 14, 2018 5:44 pm
Qua Nov 14, 2018 5:41 pm
Qua Nov 14, 2018 5:14 pm
Qua Nov 14, 2018 4:30 pm
Qua Nov 14, 2018 3:35 pm
Qua Nov 14, 2018 2:45 pm
Qua Nov 14, 2018 1:25 pm
Qua Nov 14, 2018 10:45 am
Ter Nov 13, 2018 11:25 pm
Ter Nov 13, 2018 11:23 pm
Ter Nov 13, 2018 11:18 pm
Ter Nov 13, 2018 10:55 pm
Ter Nov 13, 2018 6:21 pm
Ter Nov 13, 2018 5:55 pm
Ter Nov 13, 2018 1:30 pm
Ter Nov 13, 2018 11:33 am
Seg Nov 12, 2018 9:52 pm
Seg Nov 12, 2018 3:57 pm
Seg Nov 12, 2018 3:24 pm
Seg Nov 12, 2018 8:13 am
Seg Nov 12, 2018 8:11 am
Dom Nov 11, 2018 6:56 pm
Dom Nov 11, 2018 2:41 pm
Dom Nov 11, 2018 8:12 am
Dom Nov 11, 2018 7:57 am
Sab Nov 10, 2018 8:54 pm
Sab Nov 10, 2018 5:11 pm
Sab Nov 10, 2018 2:52 pm
Sab Nov 10, 2018 2:13 pm
Sab Nov 10, 2018 12:39 am
Sab Nov 10, 2018 12:28 am
Sex Nov 09, 2018 3:56 pm
Qui Nov 08, 2018 11:28 pm
Qui Nov 08, 2018 11:25 pm
Qui Nov 08, 2018 10:01 pm
Qui Nov 08, 2018 7:47 pm
Qui Nov 08, 2018 12:36 pm
Qui Nov 08, 2018 12:31 pm
Qui Nov 08, 2018 12:28 pm
Qui Nov 08, 2018 12:53 am
Qua Nov 07, 2018 5:52 pm
Qua Nov 07, 2018 4:04 pm
Qua Nov 07, 2018 12:49 pm
Ter Nov 06, 2018 2:05 pm
Ter Nov 06, 2018 12:30 pm
Ter Nov 06, 2018 11:32 am
Ter Nov 06, 2018 1:10 am
Seg Nov 05, 2018 6:57 pm
Seg Nov 05, 2018 3:36 pm
Seg Nov 05, 2018 12:44 am
Dom Nov 04, 2018 5:32 pm
Dom Nov 04, 2018 5:31 pm
Dom Nov 04, 2018 5:30 pm
Dom Nov 04, 2018 1:05 am
Sab Nov 03, 2018 1:36 pm
Sex Nov 02, 2018 11:38 pm
Sex Nov 02, 2018 10:55 pm
Sex Nov 02, 2018 8:16 pm
Sex Nov 02, 2018 7:50 pm
Sex Nov 02, 2018 7:41 pm
Sex Nov 02, 2018 7:27 pm
Sex Nov 02, 2018 6:36 pm
Sex Nov 02, 2018 3:27 pm
Sex Nov 02, 2018 3:35 am
Sex Nov 02, 2018 3:24 am
Qui Nov 01, 2018 3:56 pm
Qui Nov 01, 2018 3:52 pm
Qui Nov 01, 2018 1:18 pm
Qui Nov 01, 2018 7:57 am
Qui Nov 01, 2018 2:26 am
Qui Nov 01, 2018 2:05 am
Qua Out 31, 2018 9:20 pm
Qua Out 31, 2018 6:09 pm
Qua Out 31, 2018 7:17 am
Ter Out 30, 2018 11:34 pm
Ter Out 30, 2018 9:34 pm
Ter Out 30, 2018 5:29 pm
Ter Out 30, 2018 8:12 am
Ter Out 30, 2018 8:05 am
Seg Out 29, 2018 2:21 pm
Seg Out 29, 2018 12:03 am
Dom Out 28, 2018 5:33 pm
Dom Out 28, 2018 11:58 am
Dom Out 28, 2018 11:57 am
Sab Out 27, 2018 11:29 am
Sab Out 27, 2018 11:22 am
Sex Out 26, 2018 8:31 pm
Sex Out 26, 2018 6:21 pm
eduardonog30
Mateus2583
DuViDoSo
Regis garcia
MarceloYBP
NKKF
JohnRambo
Zack2
francieljesus
theus.mors
sabbath
sabbath
sabbath
McbDJ
rZwr
Fabricio Alves
NKKF
TioUV
JohnRambo
MarcosSchultz
MarcosSchultz
MarceloYBP
theus.mors
juniorhotes
Weslley
Callyde Jr
hamerom
luansantos
francisco barroso
Vitor Paulino
dstaroski
dstaroski
SuperGamer
Patrick
dstaroski
dstaroski
SuperGamer
Magnatah
francisco barroso
Samuelostgamer
GattiMene
MarceloYBP
SuperGamer
Tegh
francisco barroso
NKKF
GameLACK
dstaroski
dstaroski
dstaroski
jack2117
Mathss
JohnRambo
Daniel Dória
JohnRambo
gurgelg752
francisco barroso
MarcosSchultz
Nalfam
dstaroski
MarcosSchultz
dstaroski
dstaroski
dstaroski
Magnatah
Teio
Callyde Jr
hetrodo
NKKF
CarlosDT94
MarcosSchultz
MarcosSchultz
Magnatah
MrMattD
MarcosSchultz
MarcosSchultz
francisco barroso
francisco barroso
Callyde Jr
Dom3000
MarcosSchultz
MarcosSchultz
francisco barroso
MATHEUS1233
dstaroski
francisco barroso
theus.mors
Magnatah
dstaroski
dstaroski
dstaroski
MarcosSchultz
mafipt
dstaroski
dstaroski
Weslley
Weslley
Magnatah
MarcosSchultz

tenho alguns erros nos scripts do mfps mas nao consigo resolver....

Ir em baixo

DÚVIDA tenho alguns erros nos scripts do mfps mas nao consigo resolver....

Mensagem por Samuelostgamer em Sab Ago 18, 2018 6:19 pm


Assets/MFPS/Scripts/Network/bl_FootSteps.cs(173,80): error CS1750: Optional parameter expression of type `null' cannot be converted to parameter type `PhotonMessageInfo'

script:using UnityEngine;
using System.Collections;

public class bl_FootSteps : bl_PhotonHelper
{
    [HideInInspector]
    public bool CanUpdate = true;
    public bool CanSyncSteps = true;
    [Header("Sounds Lists")]
    public AudioClip[] m_dirtSounds;
    public AudioClip[] m_concreteSounds;
    public AudioClip[] m_WoodSounds;
    public AudioClip[] m_WaterSounds;
    [Header("Settings")]
    public float m_minSpeed = 2f;
    public float m_maxSpeed = 8f;
    public float audioStepLengthCrouch = 0.65f;
    public float audioStepLengthWalk = 0.45f;
    public float audioStepLengthRun = 0.25f;
    public float audioVolumeCrouch = 0.3f;
    public float audioVolumeWalk = 0.4f;
    public float audioVolumeRun = 1.0f;
    [Space(5)]
    public AudioSource InstanceReference;
    public PhotonView m_view;
    //private
    private bool isStep = true;
    private string m_MaterialHit;
    private Vector3 LastPost = Vector3.zero;
    /// <summary>
    /// 
    /// </summary>
    void Update()
    {
        if (!CanUpdate)//if remote is not updated, only receives the RPC call (optimization helps)
            return;
        if (InstanceReference == null)
            return;
        if (!isStep)
            return;

        RaycastHit hit;
        if (Physics.Raycast(transform.position, -Vector3.up, out hit, 10))
        {
            m_MaterialHit = hit.collider.transform.tag;
        }
        float m_magnitude = m_charactercontroller.velocity.magnitude;
        if (m_charactercontroller.isGrounded && isStep)
        {
            if (m_magnitude < m_minSpeed && m_magnitude > 0.75f)
            {
                if (CanSyncSteps && !PhotonNetwork.offlineMode)
                {
                    m_view.RPC("SyncSteps", PhotonTargets.Others, "Crouch", m_MaterialHit);
                }
                SyncSteps("Crouch", m_MaterialHit);
            }
            else if (m_magnitude > m_minSpeed && m_magnitude < m_maxSpeed)
            {
                if (CanSyncSteps && !PhotonNetwork.offlineMode)
                {
                    m_view.RPC("SyncSteps", PhotonTargets.Others, "Walk", m_MaterialHit);
                }
                SyncSteps("Walk", m_MaterialHit);
            }
            else if (m_magnitude > m_maxSpeed)
            {
                if (CanSyncSteps && !PhotonNetwork.offlineMode)
                {
                    m_view.RPC("SyncSteps", PhotonTargets.Others, "Run", m_MaterialHit);
                }
                SyncSteps("Run", m_MaterialHit);
            }
        }
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="m_material"></param>
    /// <returns></returns>
    IEnumerator Crouch(string m_material)
    {
        if (InstanceReference.GetComponent<AudioSource>() == null)
            yield return null;

        isStep = false;
        switch (m_material)
        {
            case "Dirt":
                bl_UtilityHelper.PlayClipAtPoint(m_dirtSounds[Random.Range(0, m_dirtSounds.Length)], LastPost, audioVolumeCrouch, InstanceReference);
                break;
            case "Concrete":
                bl_UtilityHelper.PlayClipAtPoint(m_concreteSounds[Random.Range(0, m_concreteSounds.Length)], LastPost, audioVolumeCrouch, InstanceReference);
                break;
            case "Wood":
                bl_UtilityHelper.PlayClipAtPoint(m_WoodSounds[Random.Range(0, m_WoodSounds.Length)], LastPost, audioVolumeCrouch, InstanceReference);
                break;
            case "Water":
                bl_UtilityHelper.PlayClipAtPoint(m_WaterSounds[Random.Range(0, m_WaterSounds.Length)], LastPost, audioVolumeCrouch, InstanceReference);
                break;

        }
        yield return new WaitForSeconds(audioStepLengthCrouch);
        isStep = true;
    }


    /// <summary>
    /// 
    /// </summary>
    /// <param name="m_material"></param>
    /// <returns></returns>
    IEnumerator Walk(string m_material)
    {
        if (InstanceReference.GetComponent<AudioSource>() == null)
            yield return null;

        isStep = false;
        switch (m_material)
        {
            case "Dirt":
                bl_UtilityHelper.PlayClipAtPoint(m_dirtSounds[Random.Range(0, m_dirtSounds.Length)], LastPost, audioVolumeWalk, InstanceReference);
                break;
            case "Concrete":
                bl_UtilityHelper.PlayClipAtPoint(m_concreteSounds[Random.Range(0, m_concreteSounds.Length)], LastPost, audioVolumeWalk, InstanceReference);
                break;
            case "Wood":
                bl_UtilityHelper.PlayClipAtPoint(m_WoodSounds[Random.Range(0, m_WoodSounds.Length)], LastPost, audioVolumeWalk, InstanceReference);
                break;
            case "Water":
                bl_UtilityHelper.PlayClipAtPoint(m_WaterSounds[Random.Range(0, m_WaterSounds.Length)], LastPost, audioVolumeWalk, InstanceReference);
                break;

        }
        yield return new WaitForSeconds(audioStepLengthWalk);
        isStep = true;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="m_material"></param>
    /// <returns></returns>
    IEnumerator Run(string m_material)
    {
        if (InstanceReference.GetComponent<AudioSource>() == null)
           yield return null;

        isStep = false;
        switch (m_material)
        {
            case "Dirt":
                bl_UtilityHelper.PlayClipAtPoint(m_dirtSounds[Random.Range(0, m_dirtSounds.Length)], LastPost, audioVolumeRun, InstanceReference);
                break;
            case "Concrete":
                bl_UtilityHelper.PlayClipAtPoint(m_concreteSounds[Random.Range(0, m_concreteSounds.Length)], LastPost, audioVolumeRun, InstanceReference);
                break;
            case "Wood":
                bl_UtilityHelper.PlayClipAtPoint(m_WoodSounds[Random.Range(0, m_WoodSounds.Length)], LastPost, audioVolumeRun, InstanceReference);
                break;
            case "Water":
                bl_UtilityHelper.PlayClipAtPoint(m_WaterSounds[Random.Range(0, m_WaterSounds.Length)], LastPost, audioVolumeRun, InstanceReference);
                break;

        }
        
        yield return new WaitForSeconds(audioStepLengthRun);
        isStep = true;
    }

    [PunRPC]
void SyncSteps(string t_corrutine,string m_material,PhotonMessageInfo m_info =null )
    {
        if (m_info != null)
        {
            if (m_info.sender.name == gameObject.name)
            {
               GameObject player =  FindPlayerRoot(m_info.photonView.viewID);
                LastPost = player.transform.position;
                StartCoroutine(t_corrutine, m_material);
            }
        }
        else
        {
            LastPost = this.InstanceReference.transform.position;
            StartCoroutine(t_corrutine, m_material);
        }
    }

    public void OffUpdate()
    {
        CanUpdate = false;
    }
    public CharacterController m_charactercontroller
    {
        get
        {
            return this.transform.root.GetComponent<CharacterController>();
        }
    }
}






Assets/MFPS/Scripts/Network/bl_ChatRoom.cs(48,73): error CS0103: The name `PeerState' does not exist in the current context

script:using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;

public class bl_ChatRoom : bl_PhotonHelper {

    public GUISkin m_Skin;
    [Space(5)]
    public Text ChatText;
    public bool IsVisible = true;
    public bool WithSound = true;
    public int MaxMsn = 7;
    private List<string> messages = new List<string>();
    private string inputLine = "";
    [Space(5)]
    public AudioClip MsnSound;

    public static readonly string ChatRPC = "Chat";
    private float m_alpha = 2f;
    private bool isChat = false;

    void Start()
    {
        Refresh();
    }

    public void OnGUI()
    {
        if (ChatText == null)
            return;

        if (m_alpha > 0.0f && !isChat)
        {
            m_alpha -= Time.deltaTime / 2;
        }
        else if (isChat)
        {
            m_alpha = 10;
        }

        Color t_color = ChatText.color;
        t_color.a = m_alpha;
        ChatText.color = t_color;

        GUI.skin = m_Skin;
        GUI.color = new Color(1, 1, 1, m_alpha);
        if (!this.IsVisible || PhotonNetwork.connectionStateDetailed != PeerState.Joined)
        {
            return;
        }

        if (Event.current.type == EventType.KeyDown &&(Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
        {
            if (!string.IsNullOrEmpty(this.inputLine) && isChat && bl_UtilityHelper.GetCursorState)
            {
                this.photonView.RPC("Chat", PhotonTargets.All, this.inputLine);
                this.inputLine = "";
                GUI.FocusControl("");
                isChat = false;
                return; // printing the now modified list would result in an error. to avoid this, we just skip this single frame
            }
            else if (!isChat && bl_UtilityHelper.GetCursorState)
            {
                GUI.FocusControl("MyChatInput");
                isChat = true;
            }
            else
            {
                if (isChat)
                {
                    Closet();
                }
            }
        }
        if (Event.current.type == EventType.keyDown && (Event.current.keyCode == KeyCode.Tab || Event.current.character == '\t'))
        {
            Event.current.Use();
        }
        GUI.SetNextControlName("");
        GUILayout.BeginArea(new Rect(Screen.width / 2 - 150, Screen.height - 35, 300, 50));
        GUILayout.BeginHorizontal();
        GUI.SetNextControlName("MyChatInput");
        inputLine = GUILayout.TextField(inputLine);
        GUI.SetNextControlName("None");
        if (GUILayout.Button("Send", "box", GUILayout.ExpandWidth(false)))
        {
            this.photonView.RPC("Chat", PhotonTargets.All, this.inputLine);
            this.inputLine = "";
            GUI.FocusControl("");
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

    }

    /// <summary>
    /// 
    /// </summary>
    void Closet()
    {
        isChat = false;
        GUI.FocusControl("");
    }
    /// <summary>
    /// Sync Method
    /// </summary>
    /// <param name="newLine"></param>
    /// <param name="mi"></param>
    [PunRPC]
    public void Chat(string newLine, PhotonMessageInfo mi)
    {
        m_alpha = 7;
        string senderName = "anonymous";

        if (mi != null && mi.sender != null)
        {
            if (!string.IsNullOrEmpty(mi.sender.name))
            {
                senderName = mi.sender.name;
            }
            else
            {
                senderName = "Player " + mi.sender.ID;
            }
        }

        this.messages.Add("[" + senderName + "]: " + newLine);
        if (MsnSound != null && WithSound)
        {
            GetComponent<AudioSource>().PlayOneShot(MsnSound);
        }
        if (messages.Count > MaxMsn)
        {
            messages.RemoveAt(0);
        }

        ChatText.text = "";
        foreach (string m in messages)
            ChatText.text += m + "\n";
    }
    /// <summary>
    /// Local Method
    /// </summary>
    /// <param name="newLine"></param>
    public void AddLine(string newLine)
    {
        m_alpha = 7;
        this.messages.Add(newLine);
        if (messages.Count > MaxMsn)
        {
            messages.RemoveAt(0);
        }
    }

    public void Refresh()
    {
        ChatText.text = "";
        foreach (string m in messages)
            ChatText.text += m + "\n";
    }
}


Assets/MFPS/Scripts/Network/bl_ChatRoom.cs(116,13): error CS0019: Operator `!=' cannot be applied to operands of type `PhotonMessageInfo' and `null'

script:= o segundo

Assets/MFPS/Scripts/Network/bl_FootSteps.cs(175,13): error CS0019: Operator `!=' cannot be applied to operands of type `PhotonMessageInfo' and `null'

script: = o primeiro

Assets/MFPS/Scripts/Network/bl_PhotonConnection.cs(152,82): error CS0103: The name `PeerState' does not exist in the current context

script:using System;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Random = UnityEngine.Random;

public class bl_PhotonConnection : Photon.MonoBehaviour {


    private LobbyState m_state = LobbyState.PlayerName;

    public LobbyType m_LobbyType = LobbyType.OnGUI;
private string playerName;
private string hostName; //Name of room
    [Header("Photon")]
    public string AppVersion = "1.0";
    public int Port = 5055;
    public float UpdateServerListEach = 2;
    [Header("OnGUI")]
    public GUISkin Skin;
    private float alpha = 2.0f;
    [Header("UGUI")]
    public GameObject RoomInfoPrefab;
    public Transform RoomListPanel;
    public List<GameObject> MenusUI = new List<GameObject>();
    public CanvasGroup CanvasGroupRoot = null;
    public Text PhotonStatusText = null;
    public Text PlayerNameText = null;

    public Text MaxPlayerText = null;
    public Text RoundTimeText = null;
    public Text GameModeText = null;
    public Text MapNameText = null;
    public Text AntiStrpicText = null;
    public Text QualityText = null;
    public Text VolumenText = null;
    public Text SensitivityText = null;
    public Image MapPreviewImage = null;
    public InputField PlayerNameField = null;
    public InputField RoomNameField = null;
//OPTIONS
    private int m_currentQuality = 3;
    private float m_volume = 1.0f;
    private float m_sensitive = 15;
    private string[] m_stropicOptions = new string[] { "Disable", "Enable", "Force Enable" };
    private int m_stropic = 0;
    private bool GamePerRounds = false;
    private bool AutoTeamSelection = false;
    [Space(7)]
    public bool ShowPhotonStatus = false;
    public bool ShowPhotonStatics = true;
[HideInInspector]
    public bool loading = false;
    [Space(5)]
    public string[] GameModes;
    private int CurrentGameMode = 0;

//Max players in game
    public int[] maxPlayers;
private int players;
//Room Time in seconds
    public int[] RoomTime;
    private int r_Time;
    //SERVERLIST
    private RoomInfo[] roomList;
    private bool listRefreshed = false;
    private Vector2 scroll;
    private bool FirstConnect = false;
    [Space(5)]
    [Header("Effects")]
    public AudioClip a_Click;
    public AudioClip backSound;
    [System.Serializable]
    public class AllScenes
    {
        public string m_name;
        public string m_SceneName;
        public Sprite m_Preview;
    }
    public List<AllScenes> m_scenes = new List<AllScenes>();
    private List<GameObject> CacheRoomList = new List<GameObject>();
    private int CurrentScene = 0;

    /// <summary>
    /// 
    /// </summary>
    void Awake()
    {
        // this makes sure we can use PhotonNetwork.LoadLevel() on the master client and all clients in the same room sync their level automatically
        PhotonNetwork.automaticallySyncScene = true;
        PhotonNetwork.autoJoinLobby = true;

        hostName = "LovattoRoom" + Random.Range(10, 999);

        if (m_LobbyType == LobbyType.UGUI && RoomNameField != null)
        {
            RoomNameField.text = hostName;
        }

        if (string.IsNullOrEmpty(PhotonNetwork.playerName))
        { 
            // generate a name for this player, if none is assigned yet
            if (String.IsNullOrEmpty(playerName))
            {
                playerName = "Guest" + Random.Range(1, 9999);
                if (m_LobbyType == LobbyType.UGUI && PlayerNameField != null) { PlayerNameField.text = playerName; }
            }
            ChangeWindow(0);
        }
        else
        {
            StartCoroutine(Fade(LobbyState.MainMenu,1.2f));
            StartCoroutine(RefresListIE());
            if (!PhotonNetwork.connected)
            {
                ConnectPhoton();
            }
            ChangeWindow(2,1);
        }
        if (m_LobbyType == LobbyType.UGUI)
        {
            SetUpOptionsHost();
            InvokeRepeating("UpdateServerList", 1, UpdateServerListEach);
        }
        GetPrefabs();
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="t_state"></param>
    /// <returns></returns>
    IEnumerator Fade(LobbyState t_state, float t = 2.0f)
    {
        alpha = 0.0f;
        m_state = t_state;
        loading = true;
        while (alpha < t)
        {
            alpha += Time.deltaTime;
            if (m_LobbyType == LobbyType.UGUI) { CanvasGroupRoot.alpha = alpha; }
            yield return null;
        }
        loading = false;
    }
    /// <summary>
    /// 
    /// </summary>
    void ConnectPhoton()
    {
        // the following line checks if this client was just created (and not yet online). if so, we connect
        if (!PhotonNetwork.connected || PhotonNetwork.connectionStateDetailed == PeerState.PeerCreated)
        {
            PhotonNetwork.AuthValues = null;
            PhotonNetwork.ConnectUsingSettings(AppVersion);
            if (m_LobbyType == LobbyType.UGUI) { ChangeWindow(3); }
        }
    }
    /// <summary>
    /// 
    /// </summary>
    void UpdateServerList()
    {
        ServerList();
    }
    /// <summary>
    /// 
    /// </summary>
    void FixedUpdate()
    {
        if (m_LobbyType == LobbyType.UGUI)
        {
            if (PhotonNetwork.connected)
            {
                if (ShowPhotonStatus)
                {
                    PhotonStatusText.text = "<b><color=orange>STATUS:</color>  " + PhotonNetwork.connectionStateDetailed.ToString().ToUpper() + "</b>";
                    PlayerNameText.text = "<b><color=orange>PLAYER:</color>  " + PhotonNetwork.player.name + "</b>";
                }
            }
        }
    }
    
    /// <summary>
    /// Menu For Enter Name for UI 4.6 WIP
    /// </summary>
public void EnterName (InputField field = null){
        if (m_LobbyType == LobbyType.OnGUI)
        {
            playerName = playerName.Replace("\n", "");
            GUILayout.BeginArea(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 57, 375, 135), "<color=black>Player Name</color>", "window");
            GUILayout.Space(10);
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("Player Name : ");
            GUILayout.Space(5);
            GUI.SetNextControlName("user");
            playerName = playerName.Replace("\n", "");
            playerName = GUILayout.TextField(playerName, 20, GUILayout.Width(223), GUILayout.Height(33));
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Quit", GUILayout.Width(100), GUILayout.Height(33)))
            {
                PlayAudioClip(backSound, transform.position, 1.0f);
                m_state = LobbyState.Quit;
            }
            GUILayout.Space(100);
            if (GUILayout.Button("Continue", GUILayout.Width(150), GUILayout.Height(33)))
            {
                if (playerName != string.Empty && playerName.Length > 3)
                {
                    PlayAudioClip(a_Click, transform.position, 1.0f);
                    StartCoroutine(Fade(LobbyState.MainMenu));
                    StartCoroutine(RefresListIE());

                    PhotonNetwork.playerName = playerName;
                    ConnectPhoton();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
        else
        {
            if (field == null || string.IsNullOrEmpty(field.text))
                return;

            playerName = field.text;
            playerName = playerName.Replace("\n", "");

            PlayAudioClip(a_Click, transform.position, 1.0f);
            StartCoroutine(Fade(LobbyState.MainMenu));
            StartCoroutine(RefresListIE());

            PhotonNetwork.playerName = playerName;
            ConnectPhoton();
        }
}

    

    #region UGUI
    /// <summary>
    /// For button can call this 
    /// </summary>
    /// <param name="id"></param>
    public void ChangeWindow(int id)
    {
        ChangeWindow(id, -1);
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="id"></param>
    public void ChangeWindow(int id, int id2)
    {
        StartCoroutine(Fade(LobbyState.MainMenu,3f));
        for (int i = 0; i < MenusUI.Count; i++)
        {
            if (i == id || i == id2)
            {
                MenusUI[i].SetActive(true);
            }
            else
            {
                if (i != 1)//1 = mainmenu buttons
                {
                    MenusUI[i].SetActive(false);
                }
                if (id == 6 || id == Cool
                {
                    MenusUI[1].SetActive(false);
                }
            }
        }
        if (a_Click != null)
        {
            AudioSource.PlayClipAtPoint(a_Click, this.transform.position, 1.0f);
        }
    }

    public void Disconect()
    {
        if (PhotonNetwork.connected)
        { PhotonNetwork.Disconnect(); }
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="id"></param>
    public void ChangeServerCloud(int id)
    {
        if (PhotonNetwork.connected)
        {
            PhotonNetwork.Disconnect();
            Debug.LogWarning("Try again, because still not disconect");
            return;
        }
        if (PhotonNetwork.PhotonServerSettings.AppID != string.Empty)
        {
            switch (id)
            {
                case 0:
                    PhotonNetwork.ConnectToRegion(CloudRegionCode.us, AppVersion);
                    break;
                case 1:
                    PhotonNetwork.ConnectToRegion(CloudRegionCode.asia, AppVersion);
                    break;
                case 2:
                    PhotonNetwork.ConnectToRegion(CloudRegionCode.au, AppVersion);
                    break;
                case 3:
                    PhotonNetwork.ConnectToRegion(CloudRegionCode.eu, AppVersion);
                    break;
                case 4:
                    PhotonNetwork.ConnectToRegion(CloudRegionCode.jp, AppVersion);
                    break;
                   
            }
            PlayAudioClip(a_Click, transform.position, 1.0f);
        }
        else
        {
            Debug.LogWarning("Need your AppId for changer server, please add it in inspector");
        }
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="plus"></param>
    public void ChangeMaxPlayer(bool plus)
    {
        if (plus)
        {
            if (players < maxPlayers.Length)
            {
                players++;
                if (players > (maxPlayers.Length - 1)) players = 0;

            }
        }
        else
        {
            if (players < maxPlayers.Length)
            {
                players--;
                if (players < 0) players = maxPlayers.Length - 1;
            }
        }
        MaxPlayerText.text = maxPlayers[players] + " Players";
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="plus"></param>
    public void ChangeRoundTime(bool plus)
    {
        if (!plus)
        {
            if (r_Time < RoomTime.Length)
            {
                r_Time--;
                if (r_Time < 0)
                {
                    r_Time = RoomTime.Length - 1;

                }
            }
        }
        else
        {
            if (r_Time < RoomTime.Length)
            {
                r_Time++;
                if (r_Time > (RoomTime.Length - 1))
                {
                    r_Time = 0;

                }

            }
        }
        RoundTimeText.text = (RoomTime[r_Time] / 60) + " Minutes";
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="plus"></param>
    public void ChangeGameMode(bool plus)
    {
        if (plus)
        {
            if (CurrentGameMode < GameModes.Length)
            {
                CurrentGameMode++;
                if (CurrentGameMode > (GameModes.Length - 1))
                {
                    CurrentGameMode = 0;
                }
            }
        }
        else
        {
            if (CurrentGameMode < GameModes.Length)
            {
                CurrentGameMode--;
                if (CurrentGameMode < 0)
                {
                    CurrentGameMode = GameModes.Length - 1;

                }
            }
        }
        GameModeText.text = GameModes[CurrentGameMode];
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="plus"></param>
    public void ChangeMap(bool plus)
    {
        if (!plus)
        {
            if (CurrentScene < m_scenes.Count)
            {
                CurrentScene--;
                if (CurrentScene < 0)
                {
                    CurrentScene = m_scenes.Count - 1;

                }
            }
        }
        else
        {
            if (CurrentScene < m_scenes.Count)
            {
                CurrentScene++;
                if (CurrentScene > (m_scenes.Count - 1))
                {
                    CurrentScene = 0;
                }
            }
        }
        MapNameText.text = m_scenes[CurrentScene].m_name;
        MapPreviewImage.sprite = m_scenes[CurrentScene].m_Preview;
    }

    public void ChangeAntiStropic(bool plus)
    {
        if (!plus)
        {
            if (m_stropic < m_stropicOptions.Length)
            {
                m_stropic--;
                if (m_stropic < 0)
                {
                    m_stropic = m_stropicOptions.Length - 1;

                }
            }
        }
        else
        {
            if (m_stropic < m_stropicOptions.Length)
            {
                m_stropic++;
                if (m_stropic > (m_stropicOptions.Length - 1))
                {
                    m_stropic = 0;
                }
            }
        }
        AntiStrpicText.text = m_stropicOptions[m_stropic];
    }

    public void ChangeQuality(bool plus)
    {
        if (!plus)
        {
            if (m_currentQuality < QualitySettings.names.Length)
            {
                m_currentQuality--;
                if (m_currentQuality < 0)
                {
                    m_currentQuality = QualitySettings.names.Length - 1;

                }
            }
        }
        else
        {
            if (m_currentQuality < QualitySettings.names.Length)
            {
                m_currentQuality++;
                if (m_currentQuality > (QualitySettings.names.Length - 1))
                {
                    m_currentQuality = 0;
                }
            }
        }
        QualityText.text = QualitySettings.names[m_currentQuality];
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="b"></param>
    public void QuitGame(bool b)
    {
        if (b)
        {
            Application.Quit();
            Debug.Log("Game Exit, this only work in standalone version");
        }
        else
        {
            StartCoroutine(Fade(LobbyState.MainMenu, 3.2f));
            ChangeWindow(2, 1);
        }
    }

    public void ChangeAutoTeamSelection(bool b) { AutoTeamSelection = b; }
    public void ChangeGamePerRound(bool b) { GamePerRounds = b; }
    public void ChangeRoomName(string t) { hostName = t; }
    public void ChangeVolume(float v) { m_volume = v; VolumenText.text = (m_volume * 100).ToString("00") +"%"; }
    public void ChangeSensitivity(float s) { m_sensitive = s; SensitivityText.text = m_sensitive.ToString("00") + "%"; }
    /// <summary>
    /// 
    /// </summary>
    void SetUpOptionsHost()
    {
        MaxPlayerText.text = maxPlayers[players] + " Players";
        RoundTimeText.text = (RoomTime[r_Time] / 60) + " Minutes";
        GameModeText.text = GameModes[CurrentGameMode];
        MapNameText.text = m_scenes[CurrentScene].m_name;
        MapPreviewImage.sprite = m_scenes[CurrentScene].m_Preview;
        AntiStrpicText.text = m_stropicOptions[m_stropic];
        SensitivityText.text = m_sensitive.ToString("00") + "%";
        VolumenText.text = (m_volume * 100).ToString("00") + "%";
        QualityText.text = QualitySettings.names[m_currentQuality];
    }
    public void Save()
    {
        PlayerPrefs.SetFloat("volumen", m_volume);
        PlayerPrefs.SetFloat("sensitive", m_sensitive);
        PlayerPrefs.SetInt("quality", m_currentQuality);
        PlayerPrefs.SetInt("anisotropic", m_stropic);
        Debug.Log("Save Done!");
    }
    #endregion
    #region OnGUI
    /// <summary>
    /// 
    /// </summary>
    void OnGUI()
    {
        if (m_LobbyType != LobbyType.OnGUI)
            return;

        GUI.skin = Skin;
        if (m_state == LobbyState.ChangeServer)
        {
            SelectServer();
        }
        if (m_state == LobbyState.PlayerName)
        {
            EnterName();
        }
        if (PhotonNetwork.connected && !PhotonNetwork.connecting)
        {
            FirstConnect = true;
            if (m_state == LobbyState.PlayerName)
            {
                GUI.Label(new Rect(Screen.width - 150, 20, 150, 30), "<b><size=14> Version 1.0f </size></b>");
            }

            if (ShowPhotonStatus)
            {
                GUI.Label(new Rect(0, 55, 500, 20), " <b><color=orange> Status:</color>  " + PhotonNetwork.connectionStateDetailed.ToString() + "</b>");
                GUI.Label(new Rect(0, 80, 500, 20), " <b><color=orange> Player:</color>  " + PhotonNetwork.player.name + "</b>");
            }
            if (ShowPhotonStatics)
            {
                ShowStaticSever();
            }

            if (loading && m_state != LobbyState.PlayerName)
            {
                GUI.enabled = false;
            }
            else
            {
                GUI.enabled = true;
            }

            //Everything after this line will be affected when we will change "alpha"
            GUI.color = new Color(1.0f, 1.0f, 1.0f, alpha);

            if (m_state != LobbyState.PlayerName)
            {
                MainMenu();
            }
            if (m_state == LobbyState.PlayerName)
            {
                EnterName();
            }
            else if (m_state == LobbyState.Join)
            {
                ServerList();
            }
            else if (m_state == LobbyState.MainMenu)
            {
                ServerList();
            }
            else if (m_state == LobbyState.Host)
            {
                CreateServer();
            }
            else if (m_state == LobbyState.Settings)
            {
                Settings();
            }
            else if (m_state == LobbyState.Quit)
            {
                QuitGame();
            }

            if (m_state != LobbyState.PlayerName && m_state != LobbyState.MainMenu)
            {
                ButtonBack();
            }
        }
        else if (!FirstConnect)
        {
            if (PhotonNetwork.connecting)
            {
                GUI.Box(new Rect(Screen.width / 2 - 100, Screen.height / 2, 200, 60), "Connecting...", "window");
            }
            else
            {
                GUILayout.Label("Not connected. Check console output. (" + PhotonNetwork.connectionState + ")");
            }
        }
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="field"></param>
    public void CancelEnterName(InputField field)
    {
        field.text = "Player (" + Random.Range(0, 9999) + ")";
    }
    /// <summary>
    /// Menu GUI for select a server to connect
    /// </summary>
    void SelectServer()
    {
        if (PhotonNetwork.connected)
        {
            PhotonNetwork.Disconnect();
        }
        GUILayout.BeginArea(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 150, 350, 300), "", "window");
        GUILayout.Space(10);
        GUILayout.Label("Available Regions");
        GUILayout.Space(10);
        if (GUILayout.Button("US (East Coast)",GUILayout.Height(35)))
        {
            if (PhotonNetwork.PhotonServerSettings.AppID != string.Empty)
            {
                PhotonNetwork.ConnectToMaster("app-us.exitgamescloud.com", Port, PhotonNetwork.PhotonServerSettings.AppID, AppVersion);
                PlayAudioClip(a_Click, transform.position, 1.0f);
                StartCoroutine(Fade(LobbyState.MainMenu));
            }
        }
        if (GUILayout.Button("EU (Amsterdam)", GUILayout.Height(35)))
        {
            if (PhotonNetwork.PhotonServerSettings.AppID != string.Empty)
            {
                PhotonNetwork.ConnectToMaster("app-eu.exitgamescloud.com", Port, PhotonNetwork.PhotonServerSettings.AppID, AppVersion);
                PlayAudioClip(a_Click, transform.position, 1.0f);
                StartCoroutine(Fade(LobbyState.MainMenu));
            }
        }
        if (GUILayout.Button("Asia (Singapore)", GUILayout.Height(35)))
        {
            if (PhotonNetwork.PhotonServerSettings.AppID != string.Empty)
            {
                PhotonNetwork.ConnectToMaster("app-asia.exitgamescloud.com", Port, PhotonNetwork.PhotonServerSettings.AppID, AppVersion);
                PlayAudioClip(a_Click, transform.position, 1.0f);
                StartCoroutine(Fade(LobbyState.MainMenu));
            }
        }
        if (GUILayout.Button("Japan (Tokyo)", GUILayout.Height(35)))
        {
            if (PhotonNetwork.PhotonServerSettings.AppID != string.Empty)
            {
                PhotonNetwork.ConnectToMaster("app-jp.exitgamescloud.com", Port, PhotonNetwork.PhotonServerSettings.AppID, AppVersion);
                PlayAudioClip(a_Click, transform.position, 1.0f);
                StartCoroutine(Fade(LobbyState.MainMenu));
            }
        }
        if (GUILayout.Button("Australia (Melbourne) ", GUILayout.Height(35)))
        {
            if (PhotonNetwork.PhotonServerSettings.AppID != string.Empty)
            {
                PhotonNetwork.ConnectToMaster("app-au.exitgamescloud.com", Port, PhotonNetwork.PhotonServerSettings.AppID, AppVersion);
                PlayAudioClip(a_Click, transform.position, 1.0f);
                StartCoroutine(Fade(LobbyState.MainMenu));
            }
        }
        GUILayout.EndArea();
        GUI.Label(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 165, 400, 100), "Choose the server nearest your location\n since this depends on the <color=orange>Ping.</color>");
    }

    /// <summary>
    /// 
    /// </summary>
void MainMenu (){
        GUILayout.BeginArea(new Rect(0,0,Screen.width,60));
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Search Room", GUILayout.Height(GetButtonSize(LobbyState.Join))))
        {
            m_state = LobbyState.Join;
            StartCoroutine(RefresListIE());
            PlayAudioClip(a_Click, transform.position, 1.0f);
        }
        if (GUILayout.Button("Host Room", GUILayout.Height(GetButtonSize(LobbyState.Host))))
        {
            m_state = LobbyState.Host;
            PlayAudioClip(a_Click, transform.position, 1.0f);
        }
        if (GUILayout.Button("Setting", GUILayout.Height(GetButtonSize(LobbyState.Settings))))
        {
            m_state = LobbyState.Settings;
            PlayAudioClip(a_Click, transform.position, 1.0f);
        }
        if (GUILayout.Button("Change Server", GUILayout.Height(GetButtonSize(LobbyState.ChangeServer))))
        {
            m_state = LobbyState.ChangeServer;
            PlayAudioClip(a_Click, transform.position, 1.0f);
        }
        if (GUILayout.Button("Quit", GUILayout.Height(GetButtonSize(LobbyState.Quit))))
        {
            m_state = LobbyState.Quit;
            PlayAudioClip(a_Click, transform.position, 1.0f);
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
}
    /// <summary>
    /// 
    /// </summary>
    void CreateServer()
    {
        GUILayout.BeginArea(new Rect(Screen.width / 2 - 225, Screen.height / 2 - 165, 450, 400), "", "window");
        GUILayout.Space(10);
        GUILayout.BeginVertical();
        GUILayout.Space(15);
        GUI.Box(new Rect(30, 35, 150, 30), "Host Name: ");
        hostName = hostName.Replace("\n", "");
        hostName = GUI.TextField(new Rect(200, 35, 220, 30), hostName, 20);


        //Max Player Select
        GUILayout.BeginHorizontal();
        GUI.Box(new Rect(30, 70, 150, 30), "Max Players: ");
        if (GUI.Button(new Rect(200, 70, 40, 30), "<<", "Box"))
        {
            if (players < maxPlayers.Length)
            {
                players--;
                if (players < 0) players = maxPlayers.Length - 1;
            }
        }

        GUI.Box(new Rect(260, 70, 100, 30), maxPlayers[players].ToString());
        if (GUI.Button(new Rect(380, 70, 40, 30), ">>", "Box"))
        {
            if (players < maxPlayers.Length)
            {
                players++;
                if (players > (maxPlayers.Length - 1)) players = 0;

            }
        }
        GUILayout.EndHorizontal();
        //Room Time select
        GUILayout.BeginHorizontal();
        GUI.Box(new Rect(30, 110, 150, 30), "Max Time: ");
        if (GUI.Button(new Rect(200, 110, 40, 30), "<<", "Box"))
        {
            if (r_Time < RoomTime.Length)
            {
                r_Time--;
                if (r_Time < 0)
                {
                    r_Time = RoomTime.Length - 1;

                }
            }
        }

        GUI.Box(new Rect(260, 110, 100, 30), (RoomTime[r_Time] / 60) + " <size=12>Min</size>");
        if (GUI.Button(new Rect(380, 110, 40, 30), ">>", "Box"))
        {
            if (r_Time < RoomTime.Length)
            {
                r_Time++;
                if (r_Time > (RoomTime.Length - 1))
                {
                    r_Time = 0;

                }

            }
        }
        GUILayout.EndHorizontal();
        //GameMode Select
        GUILayout.BeginHorizontal();
        GUI.Box(new Rect(30, 150, 150, 30), "Game Mode: ");
        if (GUI.Button(new Rect(200, 150, 40, 30), "<<", "Box"))
        {
            if (CurrentGameMode < GameModes.Length)
            {
                CurrentGameMode--;
                if (CurrentGameMode < 0)
                {
                    CurrentGameMode = GameModes.Length - 1;

                }
            }
        }

        GUI.Box(new Rect(260, 150, 100, 30), GameModes[CurrentGameMode]);
        if (GUI.Button(new Rect(380, 150, 40, 30), ">>", "Box"))
        {
            if (CurrentGameMode < GameModes.Length)
            {
                CurrentGameMode++;
                if (CurrentGameMode > (GameModes.Length - 1))
                {
                    CurrentGameMode = 0;
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUI.Button(new Rect(25, 190, 75, 30), "<<", "Box"))
        {
            if (CurrentScene < m_scenes.Count)
            {
                CurrentScene--;
                if (CurrentScene < 0)
                {
                    CurrentScene = m_scenes.Count - 1;

                }
            }
        }
        GUI.DrawTexture(new Rect(100, 190, 250, 100), m_scenes[CurrentScene].m_Preview.texture);
        GUI.Box(new Rect(100, 265, 250, 25), m_scenes[CurrentScene].m_name);
        if (GUI.Button(new Rect(350, 190, 75, 30), ">>", "Box"))
        {
            if (CurrentScene < m_scenes.Count)
            {
                CurrentScene++;
                if (CurrentScene > (m_scenes.Count - 1))
                {
                    CurrentScene = 0;
                }
            }
        }
        GUILayout.EndHorizontal();

        GamePerRounds = GUI.Toggle(new Rect(265, 300, 200, 30), GamePerRounds, "Game Per Rounds");
        AutoTeamSelection = GUI.Toggle(new Rect(30, 300, 200, 30), AutoTeamSelection, "Auto Team Selection");


        GUILayout.BeginHorizontal();
        //Create a new Room with Photon
        if (GUI.Button(new Rect(150, 330, 175, 50), "Create Room"))
        {
            CreateRoom();
        }

        GUILayout.Space(20);
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }

    /// <summary>
    /// 
    /// </summary>
    void ServerList()
    {
        if (m_LobbyType == LobbyType.OnGUI)
        {
            GUILayout.BeginArea(new Rect(Screen.width / 2 - 400, Screen.height / 2 - 180, 800, 400), Skin.customStyles[3]);

            GUI.Box(new Rect(25, 10, 150, 35), "Host Name");
            GUI.Box(new Rect(180, 10, 140, 35), "Map Name");
            GUI.Box(new Rect(325, 10, 130, 35), "Game Mode");
            GUI.Box(new Rect(460, 10, 80, 35), "Players");
            GUI.Box(new Rect(545, 10, 60, 35), "Ping");
            //Refresh ServerList
            if (GUI.Button(new Rect(610, 10, 130, 35), "Refresh"))
            {
                StartCoroutine(RefresListIE());

            }

            scroll = GUI.BeginScrollView(new Rect(10, 67, 770, 315), scroll, new Rect(0, 0, 220, 1000), false, true);

            if (listRefreshed && !loading)
            {
                foreach (RoomInfo room in PhotonNetwork.GetRoomList())
                {
                    GUILayout.BeginHorizontal("Label");

                    GUILayout.Box(room.name, GUILayout.Width(150), GUILayout.Height(30));
                    GUILayout.Box((string)room.customProperties[PropiertiesKeys.SceneNameKey], GUILayout.Width(140), GUILayout.Height(30));
                    GUILayout.Box((string)room.customProperties[PropiertiesKeys.GameModeKey], GUILayout.Width(130), GUILayout.Height(30));
                    GUILayout.Box(room.playerCount + "/" + room.maxPlayers, GUILayout.Width(80), GUILayout.Height(30));
                    GUILayout.Box(PhotonNetwork.GetPing().ToString(), GUILayout.Width(60), GUILayout.Height(30));
                    if (GUILayout.Button("Join Game", GUILayout.Width(120), GUILayout.Height(30)))
                    {
                        if (room.playerCount < room.maxPlayers)
                        {
                            PhotonNetwork.JoinRoom(room.name);
                            PhotonNetwork.playerName = playerName;
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                if (roomList.Length == 0 && !loading) GUI.Label(new Rect(320, 150, 200, 30), "No room created ... create one.");
            }
            GUI.EndScrollView();
            GUILayout.EndArea();
        }
        else
        {
            //Removed old list
            if (CacheRoomList.Count > 0)
            {
                foreach (GameObject g in CacheRoomList)
                {
                    Destroy(g);
                }
                CacheRoomList.Clear();
            }
            //Update List
            RoomInfo[] ri = PhotonNetwork.GetRoomList();
            if (ri.Length > 0)
            {
                http://RoomListText.text = string.Empty;
                for (int i = 0; i < ri.Length; i++)
                {
                    GameObject r = Instantiate(RoomInfoPrefab) as GameObject;
                    CacheRoomList.Add(r);
                    r.GetComponent<bl_RoomInfo>().GetInfo(ri[i]);
                    r.transform.SetParent(RoomListPanel, false);
                }
            }
            else
            {
                // RoomListText.text = "There is no room created yet, create your one.";
            }
        }
    }
    /// <summary>
    /// Menu GUI for settings
    /// </summary>
    void Settings()
    {

        GUILayout.BeginArea(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 170, 500, 350), "", "window");
        GUILayout.Space(10);
        GUILayout.Box("Setting");
        GUILayout.Label("Quality Level");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("<<"))
        {
            if (m_currentQuality < QualitySettings.names.Length)
            {
                m_currentQuality--;
                if (m_currentQuality < 0)
                {
                    m_currentQuality = QualitySettings.names.Length - 1;

                }
            }
        }
        GUILayout.Box(QualitySettings.names[m_currentQuality]);
        if (GUILayout.Button(">>"))
        {
            if (m_currentQuality < QualitySettings.names.Length)
            {
                m_currentQuality++;
                if (m_currentQuality > (QualitySettings.names.Length - 1))
                {
                    m_currentQuality = 0;
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Label("Anisotropic Filtering");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("<<"))
        {
            if (m_stropic < m_stropicOptions.Length)
            {
                m_stropic--;
                if (m_stropic < 0)
                {
                    m_stropic = m_stropicOptions.Length - 1;

                }
            }
        }
        GUILayout.Box(m_stropicOptions[m_stropic]);
        if (GUILayout.Button(">>"))
        {
            if (m_stropic < m_stropicOptions.Length)
            {
                m_stropic++;
                if (m_stropic > (m_stropicOptions.Length - 1))
                {
                    m_stropic = 0;
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Label("Sound Volume");
        GUILayout.BeginHorizontal();
        m_volume = GUILayout.HorizontalSlider(m_volume, 0.0f, 1.0f);
        GUILayout.Label((m_volume * 100).ToString("000"), GUILayout.Width(30));
        GUILayout.EndHorizontal();
        GUILayout.Label("Sensitivity");
        GUILayout.BeginHorizontal();
        m_sensitive = GUILayout.HorizontalSlider(m_sensitive, 0.0f, 100.0f);
        GUILayout.Label(m_sensitive.ToString("000"), GUILayout.Width(30));
        GUILayout.EndHorizontal();
        if (GUILayout.Button("Save"))
        {
            Save();
        }
        GUILayout.EndArea();
    }

    /// <summary>
    /// a simple window for quit of game (only work in Window o Mac Build)
    /// if you use Web Player, not need this
    /// </summary>
    void QuitGame()
    {

        GUILayout.BeginArea(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 100, 300, 150), "Quit", "window");
        GUILayout.Space(35);
        GUILayout.Label("Are you sure you want to exit game?");
        GUILayout.Space(10);
        GUILayout.BeginHorizontal();
        GUILayout.Space(35);
        if (GUILayout.Button("Cancel", GUILayout.Width(100), GUILayout.Height(35)))
        {
            StartCoroutine(Fade(LobbyState.MainMenu));
        }
        GUILayout.Space(15);
        if (GUILayout.Button("Ok", GUILayout.Width(100), GUILayout.Height(35)))
        {
            Application.Quit();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }

    void ButtonBack()
    {
        GUILayout.BeginArea(new Rect(10, (Screen.height - 35), 200, 100));
        if (GUILayout.Button("Back", GUILayout.Height(35)))
        {
            PlayAudioClip(backSound, transform.position, 1.0f);
            listRefreshed = false;
            StartCoroutine(Fade(LobbyState.MainMenu));
        }
        GUILayout.EndArea();
    }

    void ShowStaticSever()
    {
        GUILayout.BeginArea(new Rect(225, Screen.height - 35, Screen.width - 225, 50));
        GUILayout.BeginHorizontal();
        GUILayout.Label("<color=orange>" + PhotonNetwork.countOfPlayersInRooms + "</color> Players in Rooms");
        GUILayout.Label("<color=orange>" + PhotonNetwork.countOfPlayersOnMaster + "</color> Players in Lobby");
        GUILayout.Label("<color=orange>" + PhotonNetwork.countOfPlayers + "</color> Players in Server");
        GUILayout.Label("<color=orange>" + PhotonNetwork.countOfRooms + "</color> Room are Create");
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
    #endregion

    

    /// <summary>
    /// 
    /// </summary>
    public void CreateRoom()
    {
        PhotonNetwork.player.name = playerName;
        //Save Room properties for load in room
        ExitGames.Client.Photon.Hashtable roomOption = new ExitGames.Client.Photon.Hashtable();
        roomOption[PropiertiesKeys.TimeRoomKey] = RoomTime[r_Time];
        roomOption[PropiertiesKeys.GameModeKey] = GameModes[CurrentGameMode];
        roomOption[PropiertiesKeys.SceneNameKey] = m_scenes[CurrentScene].m_SceneName;
        roomOption[PropiertiesKeys.RoomRoundKey] = GamePerRounds ? "1" : "0";
        roomOption[PropiertiesKeys.TeamSelectionKey] = AutoTeamSelection ? "1" : "0";

        string[] properties = new string[5];
        properties[0] = PropiertiesKeys.TimeRoomKey;
        properties[1] = PropiertiesKeys.GameModeKey;
        properties[2] = PropiertiesKeys.SceneNameKey;
        properties[3] = PropiertiesKeys.RoomRoundKey;
        properties[4] = PropiertiesKeys.TeamSelectionKey;

        PhotonNetwork.CreateRoom(hostName, new RoomOptions()
        {
            maxPlayers = (byte)maxPlayers[players],
            isVisible = true,
            isOpen = true,
            customRoomProperties = roomOption,
            cleanupCacheOnLeave = true,
            customRoomPropertiesForLobby = properties
        }, null);
    }

/// <summary>
    /// get the list of rooms available to join
/// </summary>
/// <returns></returns>
IEnumerator RefresListIE (){
loading = true;
yield return new WaitForSeconds( 1.0f); 
roomList = PhotonNetwork.GetRoomList();
loading = false;
listRefreshed = true;
}
    /// <summary>
    /// 
    /// </summary>
    /// <param name="clip"></param>
    /// <param name="position"></param>
    /// <param name="volume"></param>
    /// <returns></returns>
AudioSource PlayAudioClip ( AudioClip clip ,   Vector3 position ,   float volume  ){
GameObject go= new GameObject ("One shot audio");
go.transform.position = position;
AudioSource source = go.AddComponent<AudioSource>();
source.clip = clip;
source.volume = volume;
source.Play ();
Destroy (go, clip.length);
return source;
}
    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    private IEnumerator MoveToGameScene()
    {
        //Wait for check
        while (PhotonNetwork.room == null)
        {
            yield return 0;
        }
        PhotonNetwork.isMessageQueueRunning = false;
        Application.LoadLevel((string)PhotonNetwork.room.customProperties[PropiertiesKeys.SceneNameKey]); 
    }
    // LOBBY EVENTS

    void OnJoinedLobby()
    {
        Debug.Log("We joined the lobby.");

        if (m_LobbyType == LobbyType.UGUI)
        {
            StartCoroutine(Fade(LobbyState.MainMenu));
            ChangeWindow(2,1);
        }
    }

    void OnLeftLobby()
    {
        Debug.Log("We left the lobby.");
    }

    // ROOMLIST

    void OnReceivedRoomList()
    {
        Debug.Log("We received a new room list, total rooms: " + PhotonNetwork.GetRoomList().Length);
    }

    void OnReceivedRoomListUpdate()
    {
        Debug.Log("We received a room list update, total rooms now: " + PhotonNetwork.GetRoomList().Length);
    }

void OnJoinedRoom (){
        Debug.Log("We have joined a room.");
        StartCoroutine(MoveToGameScene());
}
void OnFailedToConnectToPhoton ( DisconnectCause cause  ){
        Debug.LogWarning("OnFailedToConnectToPhoton: " + cause);
loading = false;
    }
    void OnConnectionFail(DisconnectCause cause)
    {
        Debug.LogWarning("OnConnectionFail: " + cause);
    }

    void GetPrefabs()
    {
        if (PlayerPrefs.HasKey("volumen"))
        {
            m_volume = PlayerPrefs.GetFloat("volumen");
            AudioListener.volume = m_volume;
        }
        if (PlayerPrefs.HasKey("sensitive"))
        {
            m_sensitive = PlayerPrefs.GetFloat("sensitive");
        }
        if (PlayerPrefs.HasKey("quality"))
        {
            m_currentQuality = PlayerPrefs.GetInt("quality");
        }
        if (PlayerPrefs.HasKey("anisotropic"))
        {
            m_stropic = PlayerPrefs.GetInt("anisotropic");
        }
    }

    private int GetButtonSize(LobbyState t_state)
    {

        if (m_state == t_state)
        {
            return 55;
        }
        else
        {
            return 40;
        }
    }

    [System.Serializable]
    public enum LobbyType
    {
        UGUI,
        OnGUI,
    }
}


Última edição por dstaroski em Dom Ago 19, 2018 8:36 am, editado 1 vez(es) (Razão : Título editado conforme padrões do fórum)

Samuelostgamer
Iniciante
Iniciante

PONTOS : 447
REPUTAÇÃO : 2
Respeito as regras :

Ver perfil do usuário

Voltar ao Topo Ir em baixo

DÚVIDA Re: tenho alguns erros nos scripts do mfps mas nao consigo resolver....

Mensagem por dstaroski em Sab Ago 18, 2018 6:24 pm

Boa noite! é de uma Asset certo? já tentou o suporte do Asset? eles com certeza poderão te dizer exatamente o problema, pelo que vi são vários scripts. Quando postar scripts use o botão "script" do editor e poste o código dentro da caixa cinza.

Abraço!
avatar
dstaroski
Instrutor

Masculino PONTOS : 3802
REPUTAÇÃO : 987
Idade : 29
Áreas de atuação : Téc. Hardware e Redes, Programação C#.

Respeito as regras :

Ver perfil do usuário https://gamejolt.com/games/defeattheilluminatis/347786

Voltar ao Topo Ir em baixo

DÚVIDA Re: tenho alguns erros nos scripts do mfps mas nao consigo resolver....

Mensagem por Samuelostgamer em Sab Ago 18, 2018 6:43 pm

@dstaroski escreveu:Boa noite! é de uma Asset certo? já tentou o suporte do Asset? eles com certeza poderão te dizer exatamente o problema, pelo que vi são vários scripts. Quando postar scripts use o botão "script" do editor e poste o código dentro da caixa cinza.

Abraço!
eu ja fiz isso mas parece que o suporte esta abandonado pois ninguem responde...sou novo na progrmação estou aprendendo com o tempo talvez eu seja melhor na programação daqui a algum tempo....vou aguardar mais respostas obrigado.
eu ja removi o valor null mas acontece um erro de simbolo o que impede de remover o valor null(nulo)
obrigado pela atenção

Samuelostgamer
Iniciante
Iniciante

PONTOS : 447
REPUTAÇÃO : 2
Respeito as regras :

Ver perfil do usuário

Voltar ao Topo Ir em baixo

Voltar ao Topo

- Tópicos similares

 
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum