public MatchChatController(MatchChatView view)
 {
     this.view = view;
 }
Example #2
0
        public override void OnInit()
        {
            base.OnInit();

            controller  = new FightMatchController(this);
            _controller = controller;

            #region RoomPanel

            roomPanel = transform.Find("RoomPanel");

            timerObj           = roomPanel.Find("TimerObj").gameObject;
            armyToggleGroup    = roomPanel.Find("MyselfObj/ArmyToggleGroup").GetComponent <ToggleGroup>();
            buttonText         = roomPanel.Find("ButtonText").GetComponent <Text>();
            titleText_match    = roomPanel.Find("Title_MatchText").GetComponent <Text>();
            titleText_matching = roomPanel.Find("Title_MatchingText").GetComponent <Text>();
            timerText_room     = roomPanel.Find("TimerObj/TimerText").GetComponent <Text>();
            matchButton        = roomPanel.Find("MatchButton").GetComponent <Button>();
            cancelButton       = roomPanel.Find("CancelButton").GetComponent <Button>();
            backButton         = roomPanel.Find("BackButton").GetComponent <Button>();

            friendTran      = roomPanel.Find("FriendObj");
            friendIconImage = friendTran.Find("FriendIconImage").GetComponent <Image>();
            friendIconImage.gameObject.SetActive(false);
            friendUnitGroup = friendTran.Find("FriendDeckUnitGroup").GetComponent <GridLayoutGroup>();
            friendNameText  = friendTran.Find("FriendNameText").GetComponent <Text>();

            myselfTran             = roomPanel.Find("MyselfObj");
            myselfIconImage        = myselfTran.Find("MyselfIconImage").GetComponent <Image>();
            myselfUnitGroup        = myselfTran.Find("MyselfDeckUnitGroup").GetComponent <GridLayoutGroup>();
            myselfNameText         = myselfTran.Find("MyselfNameText").GetComponent <Text>();
            runeLevelText          = myselfTran.Find("RuneLevelText").GetComponent <Text>();
            armyTgText1            = myselfTran.Find("ArmyToggleText1").GetComponent <Text>();
            armyTgText2            = myselfTran.Find("ArmyToggleText2").GetComponent <Text>();
            armyTgText3            = myselfTran.Find("ArmyToggleText3").GetComponent <Text>();
            armyToggle1            = myselfTran.Find("ArmyToggleGroup/ArmyToggle1").GetComponent <Toggle>();
            armyToggle2            = myselfTran.Find("ArmyToggleGroup/ArmyToggle2").GetComponent <Toggle>();
            armyToggle3            = myselfTran.Find("ArmyToggleGroup/ArmyToggle3").GetComponent <Toggle>();
            runeDropdown           = myselfTran.Find("RuneDropdown").GetComponent <Dropdown>();
            instituteSkillDropdown = myselfTran.Find("InstituteSkillDropdown").GetComponent <Dropdown>();

            armyToggle1.AddListener(OnClickArmyToggleOne);
            armyToggle2.AddListener(OnClickArmyToggleTwo);
            armyToggle3.AddListener(OnClickArmyToggleThree);
            matchButton.AddListener(OnClickMatchButton, UIEventGroup.Middle, UIEventGroup.Middle);
            cancelButton.AddListener(OnClickCancelButton, UIEventGroup.Middle, UIEventGroup.Middle);
            backButton.AddListener(OnClickBackButton);

            runeDropdown.onValueChanged.AddListener(OnValueChangeRuneDropdown);
            instituteSkillDropdown.onValueChanged.AddListener(OnValueChangeInstituteSkilldown);

            #endregion

            #region FriendPanel

            friendPanel     = transform.Find("FriendPanel");
            friendToggle    = friendPanel.Find("FriendToggle").GetComponent <Toggle>();
            nearbyToggle    = friendPanel.Find("NearbyToggle").GetComponent <Toggle>();
            friendText      = friendPanel.Find("FriendText").GetComponent <Text>();
            nearbyText      = friendPanel.Find("NearbyText").GetComponent <Text>();
            dragFriendItem  = friendPanel.Find("DragFriendItemPanel").GetComponent <ScrollRect>();
            friendItemGroup = friendPanel.Find("DragFriendItemPanel/FriendItemGroup").GetComponent <GridLayoutGroup>();

            if (dragFriendItem.GetComponent <MatchFriendScrollView>() == null)
            {
                matchFriendScrollView = dragFriendItem.gameObject.AddComponent <MatchFriendScrollView>();
            }
            else
            {
                matchFriendScrollView = dragFriendItem.GetComponent <MatchFriendScrollView>();
            }
            matchFriendScrollView.onCreateItemHandler = OnCreateMatchFriendItem;

            friendToggle.AddListener(OnClickFriendToggle);
            nearbyToggle.AddListener(OnClickNearbyToggle);

            #endregion

            #region MatchSucceedPanel

            matchSucceedPanel = transform.Find("MatchSucceedPanel");
            matchSucceedPanel.gameObject.SetActive(false);
            timerText_match    = matchSucceedPanel.Find("TimerText").GetComponent <Text>();
            myselfSucceedGroup = matchSucceedPanel.Find("MyselfSideGroup").GetComponent <GridLayoutGroup>();
            enemySucceedGroup  = matchSucceedPanel.Find("EnemySideGroup").GetComponent <GridLayoutGroup>();
            intoGameButton     = matchSucceedPanel.Find("IntoGameButton").GetComponent <Button>();

            intoGameButton.AddListener(OnClickIntoGameButton);

            #endregion

            RefreshMatchFriendItem();

            matchChatPanel = transform.Find("MatchChat").gameObject.AddComponent <MatchChatView>();
            matchChatPanel.Init();
        }