Beispiel #1
0
 public override void onClosed()
 {
     #region remove listeners from events
     //TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_CREATETEAM, OnTeamStatuChange);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_CREATETEAM, OnCreateTeam);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_CHANGECAPTAIN, OnTeamStatuChange);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_KICKOUT, OnMemberInfoChange);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_NEWMEMBERJOIN, OnMemberInfoChange);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_LEAVETEAM, OnMemberInfoChange);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_CURPAGE_TEAM, OnRefreshTeamInfo);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_AFFIRMINVITE, OnTeamStatuChange);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_DISSOLVETEAM, OnTeamDissolve);
     TeamProxy.getInstance().removeEventListener(TeamProxy.EVENT_TEAM_READY, OnReady);
     #endregion
     levelId = 0;
     tfOpRoot.SetParent(transform, false);
     tfOpRoot.gameObject.SetActive(false);
     if (uiData != null && uiData.Count == 1)
     {
         bufferData = uiData;
     }
     for (int i = rectContent.transform.childCount; i > 0; i--)
     {
         Destroy(rectContent.transform.GetChild(i - 1).gameObject);
     }
     Instance = null;
 }
Beispiel #2
0
        public override void init()
        {
            inText();
            a3_counterpartModel.getInstance();
            //保存一些预制件
            #region init prefab
            #endregion
            Instance      = this;
            togDiffEasy   = getComponentByPath <Toggle>("select_diff/diff_easy");
            togDiffNormal = getComponentByPath <Toggle>("select_diff/diff_normal");
            togDiffHard   = getComponentByPath <Toggle>("select_diff/diff_hard");
            togDiffCrazy  = getComponentByPath <Toggle>("select_diff/diff_crazy");
            togDiffEasy.onValueChanged.AddListener((bool selected) =>
            {
                if (selected)
                {
                    curSelectedDiff = 1;
                    TeamProxy.getInstance().SendGetPageTeam(levelId, TeamProxy.BEGININDEX, TeamProxy.ENDINDEX);
                }
            });
            togDiffNormal.onValueChanged.AddListener((bool selected) =>
            {
                if (selected)
                {
                    curSelectedDiff = 2;
                    TeamProxy.getInstance().SendGetPageTeam(levelId, TeamProxy.BEGININDEX, TeamProxy.ENDINDEX);
                }
            });
            togDiffHard.onValueChanged.AddListener((bool selected) =>
            {
                if (selected)
                {
                    curSelectedDiff = 3;
                    TeamProxy.getInstance().SendGetPageTeam(levelId, TeamProxy.BEGININDEX, TeamProxy.ENDINDEX);
                }
            });
            togDiffCrazy.onValueChanged.AddListener((bool selected) =>
            {
                if (selected)
                {
                    curSelectedDiff = 4;
                    TeamProxy.getInstance().SendGetPageTeam(levelId, TeamProxy.BEGININDEX, TeamProxy.ENDINDEX);
                }
            });

            toggleApply = getGameObjectByPath("apply").GetComponent <Toggle>();
            toggleApply.onValueChanged.AddListener((b) => { TeamProxy.getInstance().SendEditorInfoDirJoin(b); });
            btnStart = new BaseButton(transform.Find("btn_start"));
            //btnCreate = new BaseButton(transform.Find("btn_create"));
            //btnQuickJoin = new BaseButton(transform.Find("btn_quickJoin"));
            btnCreate          = new BaseButton(transform.Find("btn_quickJoin"));
            btnQuickJoin       = new BaseButton(transform.Find("btn_create"));
            btncall            = new BaseButton(getTransformByPath("btn_call"));
            btnInvite          = new BaseButton(transform.Find("btn_invite"));
            tfOpRoot           = transform.Find("op");
            btnOpClose         = new BaseButton(transform.Find("op/close"));
            btnOpLookup        = new BaseButton(transform.Find("op/lookup"));
            btnOpKick          = new BaseButton(transform.Find("op/kick"));
            btnOpClose.onClick = (g) => { tfOpRoot.gameObject.SetActive(false); };
            //btnOpClose = new MuGame.BaseButton(transform.Find("op/close"));
            //btnOpClose.onClick = (go) => { tfOpRoot.gameObject.SetActive(false); };
            btnClose             = new BaseButton(transform.Find("btn_close"));
            btnRefresh           = new BaseButton(transform.Find("btn_refresh"));
            btnStart.onClick     = OnClickStartFB;
            btnCreate.onClick    = OnClickCreateTeam;
            btnQuickJoin.onClick = OnClickQuickJoin;
            btnInvite.onClick    = OnClickInvite;
            btnOpLookup.onClick  = OnClickOpLookUp;
            btnOpKick.onClick    = OnClickOpKick;
            btncall.onClick      = OnClickMsg;
            btnRefresh.onClick   = (go) => TeamProxy.getInstance().SendGetPageTeam(levelId, TeamProxy.BEGININDEX, TeamProxy.ENDINDEX);
            btnClose.onClick     = (go) => InterfaceMgr.getInstance().close(InterfaceMgr.A3_FB_TEAM);

            txtLevelName     = getComponentByPath <Text>("fb_name");
            prefabTeamInfo   = getGameObjectByPath("template/team_pre");
            tfTeamPanel      = getTransformByPath("team_panel");
            contTeamPanel    = tfTeamPanel.Find("scroll");
            rectContent      = contTeamPanel.Find("content").GetComponent <RectTransform>();
            leContent        = contTeamPanel.Find("content").GetComponent <LayoutElement>();
            leftTimes        = getComponentByPath <Text>("text_leftTime/times");
            needZDL          = getComponentByPath <Text>("text_needZDL/zdl");
            srctTeamPanel    = tfTeamPanel.GetComponent <ScrollRect>();
            vlayoutTeamPanel = contTeamPanel.GetComponent <VerticalLayoutGroup>();
            expandHeight     = Mathf.Abs(vlayoutTeamPanel.padding.top);
            baseHeight       = prefabTeamInfo.GetComponent <LayoutElement>().minHeight;
            invitePanel.Init();
        }
Beispiel #3
0
        public override void onShowed()
        {
            if (uiData != null && uiData.Count == 2 && (bool)uiData[1])
            {
                InterfaceMgr.getInstance().closeAllWin(InterfaceMgr.A3_FB_TEAM);
            }
            Instance = this;
            if (bufferData != null && (uiData == null || uiData.Count == 0))
            {
                uiData = bufferData;
            }
            if (uiData.Count > 0)
            {
                if (uiData[0] == null)
                {
                    uiData = bufferData;
                }
                levelId = (uint)uiData[0];
                Variant _levelInfo = SvrLevelConfig.instacne.get_level_data(levelId);
                if (_levelInfo != null && _levelInfo.ContainsKey("name"))
                {
                    txtLevelName.text = _levelInfo["name"];
                }
                Variant data = SvrLevelConfig.instacne.get_level_data(levelId);


                Variant datasss         = SvrLevelConfig.instacne.get_level_data(levelId);
                int     thisday_count_g = data["daily_cnt"];

                int vip_buy_g = 0;
                if (MapModel.getInstance().dFbDta.ContainsKey((int)levelId))
                {
                    vip_buy_g = MapModel.getInstance().dFbDta[(int)levelId].vip_buycount;
                }
                //总次数包括购买的
                int all_count_g = thisday_count_g + vip_buy_g;
                //进入次数:
                int goin_count_g = 0;
                if (MapModel.getInstance().dFbDta.ContainsKey((int)levelId))
                {
                    goin_count_g = Mathf.Min(MapModel.getInstance().dFbDta[(int)levelId].cycleCount, all_count_g /*+ A3_VipModel.getInstance().goldFb_count*/);
                }
                // int max_times = data["daily_cnt"];
                // int use_times = 0;
                if (MapModel.getInstance().dFbDta.ContainsKey((int)levelId))
                {
                    goin_count_g   = Mathf.Min(MapModel.getInstance().dFbDta[(int)levelId].cycleCount, all_count_g);
                    leftTimes.text = (all_count_g - goin_count_g).ToString();
                }
                else
                {
                    leftTimes.text = all_count_g.ToString();  /*"0";*/
                }
            }
            else
            {
                return;
            }

            #region add listeners to events
            //TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CREATETEAM, OnTeamStatuChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CREATETEAM, OnCreateTeam);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CHANGECAPTAIN, OnTeamStatuChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_KICKOUT, OnMemberInfoChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_NEWMEMBERJOIN, OnMemberInfoChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_LEAVETEAM, OnMemberInfoChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_AFFIRMINVITE, OnMemberInfoChange);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_CURPAGE_TEAM, OnRefreshTeamInfo);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_DISSOLVETEAM, OnTeamDissolve);
            TeamProxy.getInstance().addEventListener(TeamProxy.EVENT_TEAM_READY, OnReady);
            #endregion
            #region send msg to server
            TeamProxy.getInstance().SendGetPageTeam(levelId, TeamProxy.BEGININDEX, TeamProxy.ENDINDEX);
            #endregion
            if (PlayerModel.getInstance().IsInATeam)
            {
                btnCreate.gameObject.SetActive(false);
                btnQuickJoin.gameObject.SetActive(false);
                if (PlayerModel.getInstance().IsCaptain)
                {
                    btnStart.gameObject.SetActive(true);
                    btnStart.interactable = true;
                    btnInvite.gameObject.SetActive(true);
                    btncall.gameObject.SetActive(true);
                }
                else
                {
                    btnStart.interactable = false;
                    btnInvite.gameObject.SetActive(false);
                    btncall.gameObject.SetActive(false);
                }
            }
            else
            {
                btncall.gameObject.SetActive(false);
                btnCreate.gameObject.SetActive(true);
                btnQuickJoin.gameObject.SetActive(true);
            }
            Variant levelInfo = SvrLevelConfig.instacne.get_level_data(levelId);
            if (levelInfo != null && levelInfo.ContainsKey("zdl"))
            {
                needZDL.transform.parent.gameObject.SetActive(true);
                int zdl = levelInfo["zdl"];
                if (zdl != 0)
                {
                    needZDL.text = zdl.ToString();
                }
                else
                {
                    needZDL.transform.parent.gameObject.SetActive(false);
                }
            }
            else
            {
                needZDL.transform.parent.gameObject.SetActive(false);
            }
        }