Exemplo n.º 1
0
        private void Awake()
        {
            cachedRoomList  = new Dictionary <string, RoomInfo>();
            roomListEntries = new Dictionary <string, GameObject>();

            //PlayerNameInput.text = "Jugador " + Random.Range(1000, 10000);
            //region = "";

            //inicializar el dropdown con opciones y traducción getText i18n


            string        o_game1 = I18nMng.GetText("gameTime1");
            string        o_game2 = I18nMng.GetText("gameTime2");
            string        o_game3 = I18nMng.GetText("gameTime3");
            List <string> m_GameTimeDropOptions = new List <string> {
                o_game1, o_game2, o_game3
            };

            GameTimeInputField.AddOptions(m_GameTimeDropOptions);

            string        o_round1 = I18nMng.GetText("roundTime1");
            string        o_round2 = I18nMng.GetText("roundTime2");
            string        o_round3 = I18nMng.GetText("roundTime3");
            string        o_round4 = I18nMng.GetText("roundTime4");
            List <string> m_RoundTimeDropOptions = new List <string> {
                o_round1, o_round2, o_round3, o_round4
            };

            RoundTimeInputField.AddOptions(m_RoundTimeDropOptions);
        }
Exemplo n.º 2
0
        IEnumerator OnCreateRoom()
        {
            yield return(new WaitForSeconds(.7f));

            string roomName = RoomNameInputField.text;

            roomName = (roomName.Equals(string.Empty)) ? I18nMng.GetText("room") + " " + Random.Range(1000, 10000) : roomName;

            int maxPlayers = GetMaxPlayers(MaxPlayers_InputField.value);

            //Debug.Log(maxPlayers);
            //byte maxPlayers;
            //byte.TryParse(MaxPlayersInputField.text, out maxPlayers);
            maxPlayers = (byte)Mathf.Clamp(maxPlayers, 4, 9);

            RoomOptions options = new RoomOptions {
                MaxPlayers = (byte)maxPlayers
            };
            Hashtable customRoomProperties = new Hashtable();

            customRoomProperties.Add("TIMER", GameTimeInputField.value);
            customRoomProperties.Add("R_TIME", RoundTimeInputField.value);
            options.CustomRoomProperties = customRoomProperties;

            PhotonNetwork.CreateRoom(roomName, options, null);
        }
Exemplo n.º 3
0
        public void DetectEdificeTakeOutHabitant()
        {
            GameObject edifice;
            bool       detected   = false;
            bool       isSelected = false;

            //ver en las 4 direcciones
            for (int i = 0; i < adjacentDirections.Length; i++)
            {
                if (GetNeighbor(adjacentDirections[i], mask).tag == "Edifice")
                {
                    edifice    = GetNeighbor(adjacentDirections[i], mask);
                    isSelected = edifice.GetComponent <Edifice>().isSelectedOutHabitant;
                    if (edifice.GetComponent <Edifice>().isInspected&& !edifice.GetComponent <Edifice>().BurnedEdifice) // el edificio fue inspeccionado
                    {
                        int cont = 0;
                        for (int j = 0; j < 3; j++)
                        {
                            if (edifice.GetComponent <Edifice>().habitants[j].image.enabled) // si hay habitantes
                            {
                                if (isSelected)
                                {
                                    edifice.GetComponent <Edifice>().habitants[j].interactable = false;
                                    edifice.GetComponent <SpriteRenderer>().color          = new Color(1f, 1f, 1f, 1f);
                                    edifice.GetComponent <Edifice>().isSelectedOutHabitant = false;
                                }
                                else
                                {
                                    edifice.GetComponent <Edifice>().isSelectedOutHabitant     = true;
                                    edifice.GetComponent <Edifice>().habitants[j].interactable = true;
                                    edifice.GetComponent <SpriteRenderer>().color = new Color(.85f, .85f, .85f, 0.3f);
                                    detected = true;
                                }
                            }
                            else
                            {
                                cont++;
                            }
                        }
                        if (cont == 3 && isSelected)
                        {
                            detected   = false;
                            isSelected = false;
                        }
                        edifice.GetComponent <Edifice>().idPositionEdifice = i;
                    }
                }
            }
            //activa panel de notificacion
            if (!detected && !isSelected)
            {
                UIManagerGame.sharedInstance.ShowPanelNotification(I18nMng.GetText("noInhabitantsToShow"));
            }
        }
Exemplo n.º 4
0
        public override void OnJoinRandomFailed(short returnCode, string message)
        {
            room = I18nMng.GetText("room");
            string roomName = room + " " + Random.Range(1000, 10000);

            RoomOptions options = new RoomOptions {
                MaxPlayers = 8
            };

            PhotonNetwork.CreateRoom(roomName, options, null);
        }
Exemplo n.º 5
0
        //Use este metodo para los mensajes de turno, llama a la corutina para activar las animaciones
        //Faltaria avusar el fuego

        //en cuanto a lo del viento, tengo una sugerencia para que se note hacia a donde va,preguntando, me dijieron
        //que se podria agregar una segunda camara que se activa para que muestre en el centro de la pantalla la brujula
        //con zoom para que se note
        private void SetTurnText(string turn)
        {
            //UIManagerGame.sharedInstance.textTurn.text = "Turno Jugador: " + turn;
            UIManagerGame.sharedInstance.textTurnStatic.enabled       = true;
            UIManagerGame.sharedInstance.textTurnStaticMaster.enabled = true;
            if (PhotonNetwork.PlayerList.Length > 1)
            {
                if (PhotonNetwork.IsMasterClient)
                {
                    UIManagerGame.sharedInstance.textTurnStaticMaster.text = I18nMng.GetText("turn") + turn;
                }
                else
                {
                    UIManagerGame.sharedInstance.textTurnStatic.text = I18nMng.GetText("turn") + turn;
                }
            }
            else
            {
                UIManagerGame.sharedInstance.textTurnStatic.text = I18nMng.GetText("turn") + turn;
            }

            StartCoroutine(AnimacionTurnos());
        }
Exemplo n.º 6
0
        // detecta si tenemos algun edificio a los lados y activa el boton del edificio
        public void DetectEdificeToInspect()
        {
            Debug.Log("detect edifice to inspect");
            GameObject edifice;
            bool       isInspected = false;
            bool       isSelected  = false;

            for (int i = 0; i < adjacentDirections.Length; i++)
            {
                if (GetNeighbor(adjacentDirections[i], mask).tag == "Edifice")
                {
                    edifice    = GetNeighbor(adjacentDirections[i], mask);
                    isSelected = edifice.GetComponent <Edifice>().isSelected;
                    if (!edifice.GetComponent <Edifice>().isInspected&& !edifice.GetComponent <Edifice>().BurnedEdifice)
                    {
                        if (isSelected)
                        {
                            edifice.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f);
                            edifice.GetComponent <Edifice>().isSelected   = false;
                            edifice.GetComponent <Edifice>().btn.SetActive(false);
                        }
                        else
                        {
                            edifice.GetComponent <Edifice>().btn.SetActive(true);
                            edifice.GetComponent <Edifice>().isSelected   = true;
                            edifice.GetComponent <SpriteRenderer>().color = new Color(.85f, .85f, .85f, 0.3f);
                            isInspected = true;
                        }
                    }
                }
            }
            if (!isInspected && !isSelected)
            {
                UIManagerGame.sharedInstance.ShowPanelNotification(I18nMng.GetText("noEdificesToShow"));
            }
        }
Exemplo n.º 7
0
        public void Update()
        {
            string startText = I18nMng.GetText("startText");

            //Debug.Log("isrunning " + isTimerRunning);
            if (!isTimerRunning)
            {
                return;
            }

            float timer     = (float)PhotonNetwork.Time - startTime;
            float countdown = Countdown - timer;

            if (PhotonNetwork.PlayerList.Length > 1)
            {
                if (PhotonNetwork.IsMasterClient)
                {
                    //TextMaster.text = string.Format("Comienza en {0} segundos", countdown.ToString("n2"));
                    TextMaster.text = string.Format(startText, countdown.ToString("n2"));
                }
                else
                {
                    TextClient.text = string.Format(startText, countdown.ToString("n2"));
                }
            }
            else
            {
                TextClient.text = string.Format(startText, countdown.ToString("n2"));
            }



            if (countdown > 0.0f)
            {
                return;
            }

            isTimerRunning = false;

            if (PhotonNetwork.PlayerList.Length > 1)
            {
                if (PhotonNetwork.IsMasterClient)
                {
                    TextMaster.text = string.Empty;
                }
                else
                {
                    TextClient.text = string.Empty;
                }
            }
            else
            {
                TextClient.text = string.Empty;
            }



            if (OnCountdownTimerHasExpired != null)
            {
                OnCountdownTimerHasExpired();
            }
        }
Exemplo n.º 8
0
 public void Awake()
 {
     connectionStatusMessage = I18nMng.GetText("connectionStatus");
 }