Exemple #1
0
    void OnClickBtn(GameObject go)
    {
        int currModel   = ClientGlobal.Instance().MainPlayer.GetProp((int)PlayerProp.PkMode);
        int selectModel = int.Parse(go.name);

        GameCmd.enumPKMODE mode = (GameCmd.enumPKMODE)selectModel;
        PKModeData.Instance.SetPkMode(mode);
        m_transBtnBg.gameObject.SetActive(false);
        m_transBtnBg.transform.DestroyChildren();
    }
    /// <summary>
    /// grid 事件
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    /// <param name="param"></param>
    private void OnTABGridUIEvent(UIEventType eventType, object data, object param)
    {
        //长按
        if (eventType == UIEventType.LongPress)
        {
            IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
            if (mainPlayer != null)
            {
                this.m_pkMode = (GameCmd.enumPKMODE)mainPlayer.GetProp((int)PlayerProp.PkMode);

                ShowSelectTarget();
            }
        }
    }
Exemple #3
0
    public int SetPkMode(GameCmd.enumPKMODE mode)
    {
        if (MainPlayerPkMode == mode)
        {
            return(0);
        }

        if (mode == GameCmd.enumPKMODE.PKMODE_M_TEAM)
        {
            if (DataManager.Manager <TeamDataManager>().IsJoinTeam == false)
            {
                TipsManager.Instance.ShowTips(LocalTextType.PK_Commond_1);
                return(1);
            }
        }
        else if (mode == GameCmd.enumPKMODE.PKMODE_M_FAMILY)
        {
            if (DataManager.Manager <ClanManger>().IsJoinClan == false)
            {
                TipsManager.Instance.ShowTips(LocalTextType.PK_Commond_2);
                return(2);
            }
        }
        else if (mode == GameCmd.enumPKMODE.PKMODE_M_CAMP)
        {
            if (DataManager.Manager <ClanManger>().IsJoinClan)
            {
                if (!DataManager.Manager <ClanManger>().IsClanInDeclareWar())
                {
                    TipsManager.Instance.ShowTips(LocalTextType.PK_Commond_3);
                    return(3);
                }
            }
        }
        GameCmd.stSetPKModePropertyUserCmd_CS cmd = new GameCmd.stSetPKModePropertyUserCmd_CS();
        cmd.pkmode = (uint)mode;
        NetService.Instance.Send(cmd);
        return(0);
    }
    /// <summary>
    /// 定时更新
    /// </summary>
    void UpdateSelectTarget()
    {
        if (false == m_trans_SelectTarget.gameObject.activeSelf)
        {
            return;
        }

        tempCd += Time.deltaTime;
        if (tempCd > 1.0f)
        {
            Profiler.BeginSample("UpdateSelectTarget");

            //切换模式,清数据
            IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
            if (mainPlayer != null)
            {
                GameCmd.enumPKMODE pkMode = (GameCmd.enumPKMODE)mainPlayer.GetProp((int)PlayerProp.PkMode);
                if (this.m_pkMode != pkMode)
                {
                    CleanSelectTargetData();
                    ResetSelectTargetUIWidget();
                }

                this.m_pkMode = pkMode;
            }

            //非和平模式刷新列表
            if (this.m_pkMode != GameCmd.enumPKMODE.PKMODE_M_NORMAL)
            {
                UpdateUpdateSelectTargetList();
            }

            tempCd = 0;
            Profiler.EndSample();
        }
    }