Exemple #1
0
    /// 存入 OtherPlayerLevelData
    public static void Request_10_Before_And_10_After(Action callback = null, Action failCallback = null)
    {
        JsonData data = new JsonData();

        data["levelID"] = StaticData.LevelID;
        data["uid"]     = SelfPlayerData.Uuid;
        SnapAppApi.GetRankOfTenByLevelAndUserID(data, (SnapRpcDataVO vo) =>
        {
            //string jsonString = JsonMapper.ToJson(vo);
            LogManager.Log(" Request_10_Before_And_10_After.收到 = ", vo.data);
            LevelScroesObject scoresObject = levelObject(vo);
            if (scoresObject.data == null)
            {
                if (failCallback != null)
                {
                    failCallback.Invoke();
                }
                return;
            }
            else
            {
                OtherPlayerLevelData.Setup_10_Before_And_10_After(scoresObject);
                if (callback != null)
                {
                    callback.Invoke();
                }
            }
        });
    }
Exemple #2
0
    void Receive_10_10_RankData()
    {
        if (this.gameObject == null)
        {
            return;
        }
        if (OtherPlayerLevelData.SelfRankObject == null)
        {
            return;
        }

        text_describe.text = string.Empty;
        SelfPlayerLevelData.CurInfo.maxScore = OtherPlayerLevelData.SelfRankObject.score;
        SelfPlayerLevelData.CurInfo.rank     = OtherPlayerLevelData.SelfRankObject.rank;

        int index = 0;

        playerInfoPanels[index++].Setup(OtherPlayerLevelData.SelfRankObject);

        var lowerRanks = OtherPlayerLevelData.Get_Lower_RankObjects(3);

        foreach (var item in lowerRanks)
        {
            if (index < playerInfoPanels.Length)
            {
                playerInfoPanels[index++].Setup(item);
            }
        }
    }
Exemple #3
0
    public void OnReceive_Page_RankData()
    {
        if (this.gameObject == null)
        {
            return;
        }

        var rankObjs = OtherPlayerLevelData.Get_Page_RankObjects();

        for (int i = 0; i < rankObjs.Count; i++)
        {
            if (rankObjs[i].rank > 0)
            {
                playerInfoPanels[i].Setup(rankObjs[i]);
            }
        }

        pageNo  = OtherPlayerLevelData.PageNo;
        maxPage = Mathf.Max(0, (OtherPlayerLevelData.Total - 1)) / playerInfoPanels.Length;

        //LogManager.Log("OnReceive_Page_RankData() pageNo = " , pageNo , "  maxPage = " , maxPage);
        if (OtherPlayerLevelData.Total <= playerInfoPanels.Length)
        {
            btn_prePage.gameObject.SetActive(false);
            btn_nextPage.gameObject.SetActive(false);
        }
        else if (pageNo <= 0)
        {
            btn_prePage.gameObject.SetActive(false);
            btn_nextPage.gameObject.SetActive(true);
        }
        else if (pageNo >= maxPage)
        {
            btn_prePage.gameObject.SetActive(true);
            btn_nextPage.gameObject.SetActive(false);
        }
        else
        {
            btn_prePage.gameObject.SetActive(true);
            btn_nextPage.gameObject.SetActive(true);
        }
    }
Exemple #4
0
    IEnumerator _CorOpen()
    {
        OtherPlayerLevelData.Reset();
        yield return(null);

        foreach (var item in playerInfoPanels)
        {
            item.Reset();
        }
        loadAgain = false;
        yield return(null);

        // Song
        StaticData.LevelID = levelData.levelID;
        var _songDic = SongConfig.Instance.GetsongInfoBysongID(LanguageManager.GetSongIdFromLanguage(levelData.songID));

        print("多语言" + LanguageManager.GetSongIdFromLanguage(levelData.songID));
        text_SongName.text = _songDic["songName"];
        ChangeTitleWidth();
        // image_authorIcon
        string authorIconPath = "UI/Avatar/" + _songDic["songAuthorIconUrl"];

        image_authorIcon.sprite = Resources.Load <Sprite>(authorIconPath);
        text_childName.text     = _songDic["songAuthorName"];
        yield return(null);

        text_describe.text = LanguageManager.Instance.GetValueByKey(SelfType.NotScore.ToString(), LanguageManager.languageType);

        if (MiscUtils.IsOnline())
        {
            HttpHandler.Request_10_Before_And_10_After(Receive_10_10_RankData, Receive_None);
            AnalysisManager.Instance.OnEvent("100005", null, "关卡信息", "打开关卡:" + levelData.levelID);
            yield return(null);
        }
        else
        {
            text_describe.text = LanguageManager.Instance.GetValueByKey(SelfType.NotNetWork.ToString(), LanguageManager.languageType);
        }
    }
Exemple #5
0
    /// 存入 OtherPlayerLevelData
    public static void Request_Page(int page, Action callback = null, int countPerPage = 10)
    {
        JsonData data = new JsonData();

        data["levelID"]    = StaticData.LevelID;
        data["page"]       = page;
        data["per_page"]   = countPerPage;
        data["from_index"] = 0;
        SnapAppApi.GetRankScoresByLevelID(data, (SnapRpcDataVO vo) =>
        {
            //LogManager.Log(vo.data.ToJson());
            LevelScroesObject scoresObject = levelObject(vo);
            if (scoresObject.data == null)
            {
                return;
            }
            OtherPlayerLevelData.Setup_Page(scoresObject, page, countPerPage);
            if (callback != null)
            {
                callback.Invoke();
            }
        });
    }
Exemple #6
0
    public void SetupRankPanel()
    {
        // 拿比我好的人的信息
        higherRanks = OtherPlayerLevelData.Get_Higher_RankObjects(1);
        // 拿比我差的人的信息
        lowerRanks = OtherPlayerLevelData.Get_Lower_RankObjects(2);
        // 拿我自己信息
        myInfo = SelfPlayerLevelData.CurInfo;

        if (myInfo == null || gameObject == null)
        {
            return;
        }

        StartCoroutine(_CorActiveButton());
        obj_waitIcon.SetActive(false);
        // 临时
        var myRank = new RankObject();

        myRank.uid           = SelfPlayerData.Uuid;
        myRank.user          = new UserObject();
        myRank.user.avatar   = SelfPlayerLevelData.CurInfo.avatar;
        myRank.user.nickname = SelfPlayerLevelData.CurInfo.nickName;
        myRank.rank          = OtherPlayerLevelData.SelfRankObject.rank;
        myRank.score         = OtherPlayerLevelData.SelfRankObject.score;
        myRank.accuracy      = OtherPlayerLevelData.SelfRankObject.accuracy;


        if (SelfPlayerLevelData.TempRankIncrement > 0)
        {
            //LogManager.LogWarning("上升了");
            int index     = 0;
            var selfPanel = playerInfoPanels[index];


            selfPanel.Setup(myRank, true)
            .PlayMoveUp(enterDelay, addScoreTime);
            obj_newRecord.SetActive(SelfPlayerLevelData.ScoreIncrement > 0);
            obj_newRecord.transform.SetParent(selfPanel.transform, false);

            index++;
            foreach (var item in lowerRanks)
            {
                if (index < playerInfoPanels.Length)
                {
                    playerInfoPanels[index++].Setup(item)
                    .PlayMoveDown(enterDelay, addScoreTime);
                }
            }

            text_rankUpValue.text = SelfPlayerLevelData.TempRankIncrement.ToString();
            obj_rankUp.transform.SetParent(selfPanel.transform, false);
            obj_rankUp.transform.SetSiblingIndex(0);
            StartCoroutine(_CorShowRankUpAnim());
        }
        else
        {
            //LogManager.LogWarning("排名未变化");
            obj_rankUp.SetActive(false);
            int index = 0;
            foreach (var item in higherRanks)
            {
                playerInfoPanels[index++].Setup(item);
            }

            // 自己
            var selfPanel = playerInfoPanels[index++];
            selfPanel.Setup(myRank, true)
            .PlayMoveIn(enterDelay, addScoreTime);
            obj_newRecord.SetActive(SelfPlayerLevelData.ScoreIncrement > 0);
            obj_newRecord.transform.SetParent(selfPanel.transform, false);

            foreach (var item in lowerRanks)
            {
                if (index < playerInfoPanels.Length)
                {
                    playerInfoPanels[index++].Setup(item);
                }
            }
        }
    }