コード例 #1
0
    public override void Initialize(object[] screenParams)
    {
        base.Initialize(screenParams);

        LobbyManager.Instance.OnPlayerAdded   += OnPlayerAdded;
        LobbyManager.Instance.OnPlayerRemoved += OnPlayerRemoved;

        // populate character list
        int totalSlots = CharacterProgressData.MAX_CHARACTER_SLOTS;

        m_CharacterList = new List <UILobbyCharacterProgress>(totalSlots);
        for (int i = 0; i < totalSlots; i++)
        {
            CharacterProgress progress = CharacterManager.Instance.GetProgressForCharacterInSlot(i);
            if (progress != null)
            {
                UILobbyCharacterProgress lCP = new UILobbyCharacterProgress(progress, false);
                m_CharacterList.Add(lCP);
            }
        }

        for (int i = 0; i < m_CharacterSelectors.Length; i++)
        {
            m_CharacterSelectors[i].Init(i);
            m_CharacterSelectors[i].m_PlayerIndex = i;
            m_CharacterSelectors[i].SetData(m_CharacterList);
            m_CharacterSelectors[i].OnCharacterSelected += OnCharacterSelected;
        }
    }
コード例 #2
0
    private void ShowCharacterInList(UILobbyCharacterProgress prog)
    {
        if (prog != null)
        {
            int index = m_CharacterList.IndexOf(prog);
            if (index > -1)
            {
                m_CharacterList[index].AssignedToPlayer = false;
            }
            else
            {
                Debug.LogWarningFormat("chracter progress not in character list");
            }
        }
        else
        {
            Debug.LogWarningFormat("Tried to add null to character list");
        }

        RefreshCharacterList();
    }