Пример #1
0
        public void init(Transform trans)
        {
            a3_currentTeamPanel._instance = this;
            this.itemMemberObjList        = new List <a3_currentTeamPanel.ItemMemberObj>();
            this.txtTeambuff = trans.FindChild("right/bottom/teambuff").GetComponent <Text>();
            Transform transform = trans.FindChild("right/main/body/contains");

            this.team_object        = base.transform.FindChild("right/bottom/team_object/Dropdown").gameObject;
            this.team_object_change = this.team_object.GetComponent <Dropdown>();
            this.team_object_change.onValueChanged.AddListener(new UnityAction <int>(this.team_object_dropdownClick));
            for (int i = 0; i < transform.childCount; i++)
            {
                Transform child = transform.GetChild(i);
                a3_currentTeamPanel.ItemMemberObj item = new a3_currentTeamPanel.ItemMemberObj(child);
                this.itemMemberObjList.Add(item);
            }
            this.togInvite = trans.FindChild("right/bottom/togInvite").GetComponent <Toggle>();
            this.togJoin   = trans.FindChild("right/bottom/togJoin").GetComponent <Toggle>();
            this.togInvite.onValueChanged.AddListener(new UnityAction <bool>(this.onTogAgreenAddOtherClick));
            this.togJoin.onValueChanged.AddListener(new UnityAction <bool>(this.onTogAgreeOtherApplyClick));
            this.materialGrey  = Resources.Load <Material>("uifx/uiGray");
            this.carrSpriteDic = new Dictionary <uint, Sprite>();
            for (int j = 0; j < 3; j++)
            {
                bool flag = j == 0;
                if (flag)
                {
                    this.carrSpriteDic.Add(2u, Resources.Load <Sprite>("icon/team/warrior_team"));
                }
                bool flag2 = j == 1;
                if (flag2)
                {
                    this.carrSpriteDic.Add(3u, Resources.Load <Sprite>("icon/team/mage_team"));
                }
                bool flag3 = j == 2;
                if (flag3)
                {
                    this.carrSpriteDic.Add(5u, Resources.Load <Sprite>("icon/team/assassin_team"));
                }
            }
            BaseButton baseButton = new BaseButton(trans.FindChild("right/bottom/btnQuitTeam"), 1, 1);

            baseButton.onClick = new Action <GameObject>(this.onBtnQuitTeamClick);
            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_CREATETEAM, new Action <GameEvent>(this.onCreateTeam));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_AFFIRMINVITE, new Action <GameEvent>(this.onAffirminvite));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_NEWMEMBERJOIN, new Action <GameEvent>(this.onNewMemberJoin));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_KICKOUT, new Action <GameEvent>(this.onNoticeHaveMemberLeave));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_CHANGETEAMINFO, new Action <GameEvent>(this.onChangeTeamInfo));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_NOTICEHAVEMEMBERLEAVE, new Action <GameEvent>(this.onNoticeHaveMemberLeave));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_LEAVETEAM, new Action <GameEvent>(this.onLeaveTeam));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_NOTICEONLINESTATECHANGE, new Action <GameEvent>(this.onNoticeOnlineStateChange));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_CHANGECAPTAIN, new Action <GameEvent>(this.onChangeCaptain));

            BaseProxy <TeamProxy> .getInstance().addEventListener(TeamProxy.EVENT_TEAMOBJECT_CHANGE, new Action <GameEvent>(this.onChangeTeamObject));

            bool flag4 = BaseProxy <TeamProxy> .getInstance().MyTeamData != null;

            if (flag4)
            {
                this.team_object_change.value = this.change_v((int)BaseProxy <TeamProxy> .getInstance().MyTeamData.ltpid, false);
            }
        }
        public void init(Transform trans)
        {
            _instance = this;
            inText();
            itemMemberObjList = new List <ItemMemberObj>();
            txtTeambuff       = trans.FindChild("right/bottom/teambuff").GetComponent <Text>();
            Transform objects = trans.FindChild("right/main/body/contains");

            team_object        = transform.FindChild("right/bottom/team_object/Dropdown").gameObject;
            team_object_change = team_object.GetComponent <Dropdown>();
            team_object_change.onValueChanged.AddListener(team_object_dropdownClick);


            team_object_change.captionText.text = ContMgr.getCont("a3_teamPanel_16");
            for (int i = 0; i < team_object_change.options.Count; i++)
            {
                team_object_change.options[i].text = ContMgr.getCont("a3_teamPanel_" + (i + 16));
            }

            for (int i = 0; i < objects.childCount; i++)
            {
                Transform     child         = objects.GetChild(i);
                ItemMemberObj itemMemberObj = new ItemMemberObj(child);
                itemMemberObjList.Add(itemMemberObj);
            }
            togInvite = trans.FindChild("right/bottom/togInvite").GetComponent <Toggle>();
            /*暂时先屏蔽掉*/ //togJoin = trans.FindChild("right/bottom/togJoin").GetComponent<Toggle>();
            togInvite.onValueChanged.AddListener(onTogAgreenAddOtherClick);
            //togJoin.onValueChanged.AddListener(onTogAgreeOtherApplyClick);
            materialGrey  = U3DAPI.U3DResLoad <Material>("uifx/uiGray");
            carrSpriteDic = new Dictionary <uint, Sprite>();

            for (int i = 0; i < 3; i++)
            {
                if (i == 0)
                {
                    carrSpriteDic.Add(2, GAMEAPI.ABUI_LoadSprite("icon_team_warrior_team"));
                }
                if (i == 1)
                {
                    carrSpriteDic.Add(3, GAMEAPI.ABUI_LoadSprite("icon_team_mage_team"));
                }
                if (i == 2)
                {
                    carrSpriteDic.Add(5, GAMEAPI.ABUI_LoadSprite("icon_team_assassin_team"));
                }
            }
            BaseButton btnQuitTeam = new BaseButton(trans.FindChild("right/bottom/btnQuitTeam"));

            btnQuitTeam.onClick = onBtnQuitTeamClick;
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CREATETEAM, onCreateTeam);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_AFFIRMINVITE, onAffirminvite);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_NEWMEMBERJOIN, onNewMemberJoin);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_KICKOUT, onNoticeHaveMemberLeave);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CHANGETEAMINFO, onChangeTeamInfo);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_NOTICEHAVEMEMBERLEAVE, onNoticeHaveMemberLeave);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_LEAVETEAM, onLeaveTeam);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_NOTICEONLINESTATECHANGE, onNoticeOnlineStateChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CHANGECAPTAIN, onChangeCaptain);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_TEAMOBJECT_CHANGE, onChangeTeamObject);
            if (TeamProxy.getInstance().MyTeamData != null)
            {
                team_object_change.value = change_v((int)TeamProxy.getInstance().MyTeamData.ltpid, false);
            }

            new BaseButton(transform.Find("right/main/body/btn_call")).onClick = OnClickMsg;
        }