Exemplo n.º 1
0
    void CreatePlayerScores()
    {
        for (int i = 0; i < players.Length; i++)
        {
            GameObject playerScore = (GameObject)Instantiate(playerScorePrefab, scorePanel.transform);
            playerScore.transform.SetParent(scorePanel.transform);
            playerScore.name = players[i].gameObject.name;

            ZombieScoreUI zombieUI = GetComponentInChildren <ZombieScoreUI>();

            if (zombieUI != null)
            {
                zombieUI.playerName.text = players[i].gameObject.name;
                //zombieUI.playerName.color = playerColors[i];

                zombieUI.playerScore.text = players[i].PlayerScore.CurrentScore.ToString();
            }

            ScoreField player = new ScoreField(players[i], zombieUI);

            playerList.Add(player);
        }
    }
Exemplo n.º 2
0
        public bool ReadField(ObjectReader objectReader, Dictionary <ScoreField, int> fieldValues, ScoreField field)
        {
            switch (field)
            {
            case ScoreField.End:
                m_Script = Encoding.UTF8.GetBytes(_infoText);
                return(false);

            case ScoreField.Index:
                _infoText += $"{field}: {objectReader.ReadInt32()}\n";
                return(true);

            case ScoreField.Name:
                m_Name = MxrObjectReader.ReadString(objectReader);
                objectReader.Position--;
                return(false);

            case ScoreField.UnknownArray33:
                if (objectReader.ReadByte() != 0)
                {
                    throw new InvalidDataException();
                }

                var bytes = Enumerable.Range(0, objectReader.ReadInt32()).Select(i => objectReader.ReadByte()).ToList();
                _infoText += $"{field}: {bytes.Count} {{\n    {string.Join(",", bytes)}\n}}\n";
                return(true);

            case ScoreField.UnknownArray34:
                var strings = new List <object>();
                for (int i = 0; objectReader.ReadUInt32() != UInt32.MaxValue; i++)
                {
                    objectReader.BaseStream.Position -= 4;
                    strings.Add($"    {objectReader.ReadInt32()}, {MxrObjectReader.ReadString(objectReader)}, {objectReader.ReadInt32()}");
                }
                _infoText += $"{field}: {strings.Count} {{\n{string.Join(Environment.NewLine, strings)}\n}}\n";
                return(true);

            default:
                throw new InvalidDataException();
            }
        }