Beispiel #1
0
        void OnEnable()
        {
            if (!instance)
            {
                instance = this;
            }
            else
            {
                Debug.LogWarning("Warning! Multiple instances of \"TeamPicker\" @RoR2PVP");
            }

            //Bind
            UnassignDropdown = transform.Find("TeamPickerMenu/BottomSection/Unassign/Unassign Dropdown").GetComponent <TMP_Dropdown>();
            Content          = transform.Find("TeamPickerMenu/TeamSection/Template/Viewport/Content").GetComponent <RectTransform>();
            PlayerTemplate   = transform.Find("TeamPickerMenu/TeamSection/Template/Viewport/Content/Player Template").GetComponent <RectTransform>();

            //Set listeners
            UnassignDropdown.onValueChanged.AddListener(SetUnassignAction);

            //Reload
            List <NetworkUser> playerCache = new List <NetworkUser>();

            foreach (NetworkUser user in PlayerStates.Keys)
            {
                if (user)
                {
                    playerCache.Add(user);
                }
            }
            UnassignAction = UnassignType.LeastMembers;
            PlayerStates.Clear();
            for (int i = 0; i < playerCache.Count; i++)
            {
                AddPlayer(playerCache[i]);
            }
        }
Beispiel #2
0
 public void SetUnassignAction(int num)
 {
     UnassignAction = (UnassignType)num;
 }