Exemple #1
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        PlayerRankData mData = (PlayerRankData)data;

        if (mData.showData != null)
        {
            if (this.showData == null)
            {
                return(false);
            }
            if (!this.showData.dataEquals(mData.showData))
            {
                return(false);
            }
        }
        else
        {
            if (this.showData != null)
            {
                return(false);
            }
        }

        return(true);
    }
Exemple #2
0
    void Awake()
    {
        //Application.targetFrameRate = 60;
        Screen.SetResolution(1280, 720, false);
        Screen.showCursor = false;
        SpawnGameScene();
        for (int i = 0; i < m_PlayerData.Length; i++)
        {
            m_PlayerData[i]         = new PlayerData((PlayerIndex)i);
            m_PlayerRankData[i]     = new PlayerRankData((PlayerIndex)i);
            m_LinkGamePlayerData[i] = new LinkGamePlayerData();
            m_LanHuanExpList[i]     = new List <GameObject>();
            if (m_KongXinQiuTXArray[i] != null)
            {
                m_KongXinQiuTXArray[i].Init();
            }
        }

        _Instance = this;
        InputEventCtrl.GetInstance();
        SpawnGameUIRoot();
        if (m_LianKuangTimeAni != null)
        {
            m_LianKuangTimeAni.Init();
        }

        SpawnAudioData();
        AddCreatLanQiuStage();
        CreatAsyncImageDownload();
        //显示游戏FPS.
        ShowGameFpsInfo();

        //SetActivePlayer(PlayerIndex.Player01, true); //test
        InputEventCtrl.GetInstance().OnClickStartBtEvent += OnClickStartBtEvent;
    }
Exemple #3
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        base.toShadowCopy(data);

        if (!(data is PlayerRankData))
        {
            return;
        }

        PlayerRankData mData = (PlayerRankData)data;

        this.showData = mData.showData;
    }
Exemple #4
0
    protected override void toSetData(FuncToolData data)
    {
        base.toSetData(data);

        RankSimpleData dd = (RankSimpleData)data;

        _rankData          = GameC.factory.createPlayerRankData();
        _rankData.key      = me.role.playerID;
        _rankData.showData = me.role.getSelfRoleShowData();

        _rankData.rank  = dd.rank;
        _rankData.value = dd.value;
    }
Exemple #5
0
    /// <summary>
    /// 排名数据比较器.
    /// </summary>
    int CompareRankDt(PlayerRankData x, PlayerRankData y)//排序器
    {
        if (x == null)
        {
            if (y == null)
            {
                return(0);
            }
            return(1);
        }

        if (y == null)
        {
            return(-1);
        }

        int retval = y.Score.CompareTo(x.Score);

        return(retval);
    }
Exemple #6
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is PlayerRankData))
        {
            return;
        }

        PlayerRankData mData = (PlayerRankData)data;

        if (mData.showData != null)
        {
            this.showData = (RoleShowData)mData.showData.clone();
        }
        else
        {
            this.showData = null;
            nullObjError("showData");
        }
    }
Exemple #7
0
    protected override void toSetData(FuncToolData data)
    {
        base.toSetData(data);

        SubsectionRankSimpleData dd = (SubsectionRankSimpleData)data;

        _rankData          = GameC.factory.createPlayerRankData();
        _rankData.key      = me.role.playerID;
        _rankData.showData = me.role.getSelfRoleShowData();

        _rankData.rank  = dd.rank;
        _rankData.value = dd.value;

        _subsectionIndex    = dd.subsectionIndex;
        _subsectionSubIndex = dd.subsectionSubIndex;

        if (_pageShowTool != null)
        {
            _pageShowTool.setSubsectionIndex(_subsectionIndex, _subsectionSubIndex);
        }
    }
Exemple #8
0
    void InitRankPlayer()
    {
        RankListQiZhiObj = new GameObject[MaxPlayerRankNum];

        mRankPlayer = null;
        mRankPlayer = new PlayerRankData[MaxPlayerRankNum];
        Transform tmp = null;

        for (int i = 0; i < MaxPlayerRankNum; i++)
        {
            mRankPlayer[i] = new PlayerRankData();
            tmp            = RankListUISprite[i].transform.GetChild(0);
            if (tmp != null)
            {
                RankListQiZhiObj[i] = tmp.gameObject;
                RankListQiZhiObj[i].SetActive(false);
            }
        }

        mRankCount      = 0;
        QiZhiCount      = 0;
        IsStopCheckRank = false;
    }
Exemple #9
0
        private void ProcessRankData(BackendReturnObject bro, RankingInfo info)
        {
            JObject rankData = JObject.Parse(bro.GetReturnValue());

            List <PlayerRankData> rData = new List <PlayerRankData>();

            //다른 프로퍼티 조회해서 개수 구할 수도 있을듯
            var data = rankData["rows"];

            JArray playerDatas = JArray.Parse(data.ToString());

            foreach (var pData in playerDatas)
            {
                PlayerRankData prd = new PlayerRankData();
                foreach (var element in pData)
                {
                    string[] splitedelement = element.ToString().Split('"');

                    //string[] e = { splitedelement[1], splitedelement[3], splitedelement[5] };
                    string   t;
                    string[] temp;
                    switch (splitedelement[1])
                    {
                    case "nickname":
                        prd.nickName = splitedelement[5];
                        break;

                    case "score":
                        t    = splitedelement[4].Replace("\r", ":");
                        temp = t.Split(':');

                        prd.score = (float)Convert.ToDouble(temp[1]);
                        break;

                    case "rank":
                        t    = splitedelement[4].Replace("\r", ":");
                        temp = t.Split(':');

                        prd.rank = Convert.ToInt32(temp[1]);
                        break;

                    case "index":
                        t    = splitedelement[4].Replace("\r", ":");
                        temp = t.Split(':');

                        prd.index = Convert.ToInt32(temp[1]);
                        break;

                    case "gamerIndate":
                        prd.playerinDate = splitedelement[5];
                        break;

                    default:
                        Debug.LogError(splitedelement[1]);
                        break;
                    }

                    //Debug.LogError(string.Format("{0} {1} {2}",e[0], e[1], e[2]));
                }
                rData.Add(prd);
            }

            if (TRecord.ContainsKey(info.range))
            {
                TRecord.Remove(info.range);
            }

            TRecord.Add(info.range, rData);
            //Debug.LogError(TRecord[info.range].Count);

            //isGettingRanking = false;
        }
Exemple #10
0
        private void GetRanking(RankingInfo info)
        {
            BackendReturnObject bro = Backend.Rank.GetRankByUuid(info.UUID, DesignConstStorage.defaultRankAmount);

            var rankData = bro.GetReturnValuetoJSON()["rows"];

            List <PlayerRankData> rData = new List <PlayerRankData>();

            LitJson.JsonData[] rows = new LitJson.JsonData[rankData.Count];

            for (int i = 0; i < rows.Length; i++)
            {
                rows[i] = rankData[i];
            }

            foreach (var pData in rows)
            {
                PlayerRankData prd = new PlayerRankData();
                foreach (var k in pData.Keys)
                {
                    switch (k)
                    {
                    case "nickname":
                        prd.nickName = pData[k][0].ToString();
                        break;

                    case "score":
                        prd.score = (float)Convert.ToDouble(pData[k][0].ToString());
                        break;

                    case "rank":
                        prd.rank = Convert.ToInt32(pData[k][0].ToString());
                        break;

                    case "index":
                        prd.index = Convert.ToInt32(pData[k][0].ToString());
                        break;

                    case "gamerIndate":
                        prd.playerinDate = pData[k][0].ToString();
                        break;

                    default:
                        Debug.LogError(pData[k][0].ToString());
                        break;
                    }

                    //Debug.LogError(string.Format("{0} {1} {2}",e[0], e[1], e[2]));
                }
                rData.Add(prd);
            }

            if (TRecord.ContainsKey(info.range))
            {
                TRecord.Remove(info.range);
            }

            TRecord.Add(info.range, rData);

            //ProcessRankData(bro, info);
        }