コード例 #1
0
ファイル: State_Leaderboards.cs プロジェクト: seganx/ameza
    private void UpdatePlayerToList(Online.League.Leaderboard board)
    {
        var leaguescore = PlayModel.GetScore();

        if (leaguescore < 1)
        {
            return;
        }

        board.current.Sort((x, y) => y.score - x.score);
        if (board.current.Count < 1 || leaguescore < board.current.LastOne().score)
        {
            return;
        }

        var mine = board.current.Find(x => x.username == Profile.Username);

        if (mine == null)
        {
            board.current.RemoveAt(board.current.LastIndex());
            mine = new Online.League.Profile()
            {
                avatar = Profile.Avatar.Json, nickname = Profile.Nickname, status = Profile.Status, username = Profile.Username, score = leaguescore
            };
            board.current.Add(mine);
        }
        else if (mine.score < leaguescore)
        {
            mine.score = leaguescore;
        }
    }
コード例 #2
0
    private static void OnLose(System.Action <bool> exitplaying)
    {
        int score = PlayModel.GetScore();

        if (score > Profile.MaxClassicScore)
        {
            Profile.MaxClassicScore = score;
        }

        if (score > 0)
        {
            exitplaying(false);
            Game.Instance.OpenPopup <Popup_Lose>().Setup(replayFunc => OnReward(() =>
            {
                if (SetPlayModel())
                {
                    replayFunc();
                }
            }),
                                                         () => OnReward(() => Game.Instance.OpenState <State_Main>(true)));
        }
        else
        {
            exitplaying(true);
        }
    }
コード例 #3
0
ファイル: LeagueLogics.cs プロジェクト: seganx/ameza
    private static void OnLose(System.Action <bool> callback)
    {
        int score = PlayModel.GetScore();

        if (score > data.score)
        {
            var hashbase = "seganx_" + data.score + "&" + score + "#(" + info.id;
            Online.League.SetScore(info.id, data.score, score, hashbase.ComputeMD5(null).ToLower(), (success, value) => { });
            data.score += score;
        }

        if (score > 0)
        {
            callback(false);
            Game.Instance.OpenPopup <Popup_Lose>().Setup(replayFunc =>
            {
                if (SetPlayerModel())
                {
                    replayFunc();
                }
            },
                                                         () => Game.Instance.OpenState <State_Main>(true));
        }
        else
        {
            callback(true);
        }
    }
コード例 #4
0
 private static void OnPreLose(System.Action <bool> exitplaying)
 {
     if (PlayModel.GetScore() < Profile.MaxClassicScore)
     {
         Game.Instance.OpenPopup <Popup_Confirm>().Setup(111128, true, true, ok => exitplaying(ok)).GetComponent <UiCharacter>(true, true).SetBody(1).SetFace(2);
     }
     else
     {
         exitplaying(true);
     }
 }
コード例 #5
0
ファイル: Popup_Lose.cs プロジェクト: seganx/ameza
    private IEnumerator Start()
    {
        scoreLabel.SetText("0");

        int totalBalls = PlayModel.result.totalBalls + PlayModel.level.startBallCount;

        descLabel.SetFormatedText(PlayModel.result.totalTurn.ToString(), PlayModel.result.totalBlocks.ToString(), totalBalls);

        inviteButton.onClick.AddListener(() =>
        {
            var str = string.Format(GlobalConfig.Socials.invitationText, Profile.Username, GlobalConfig.Market.storeUrl);
            SocialAndSharing.ShareText(str);
        });

        replayButton.onClick.AddListener(() =>
        {
            onReplayFunc(() =>
            {
                base.Back();
                UIBackground.Hide();
                Game.Instance.ClosePopup(true);
                Game.Instance.OpenState <State_Playing>();
            });
        });

        baloon.gameObject.SetActive(false);
        UiShowHide.ShowAll(transform);
        yield return(new WaitForSeconds(0.5f));

        // Incentive  text
        {
            var index        = BaloonIndex++ % 25;
            var incentiveStr = LocalizationService.Get(111090 + index);
            baloon.SetText(incentiveStr);
            baloon.gameObject.SetActive(true);
        }

        float t = 0;
        float curscore = 0, maxscore = PlayModel.GetScore();
        var   wait = new WaitForEndOfFrame();

        while (t < 1)
        {
            t       += Time.deltaTime * 0.75f;
            curscore = Mathf.Lerp(0, maxscore, t);
            scoreLabel.SetText(Mathf.RoundToInt(curscore).ToString());
            yield return(wait);
        }
    }
コード例 #6
0
ファイル: LeagueLogics.cs プロジェクト: seganx/ameza
    private static void OnPreLose(System.Action <bool> callback)
    {
        var score = PlayModel.GetScore();

        if (score < 1)
        {
            callback(true);
            return;
        }

        var maxdelta    = PlayModel.type == PlayModel.Type.LeagueBalls ? 10 : 50;
        var nextProfile = GetNextNearProfile(score, maxdelta); // 111058
        var nextMedal   = GetNextNearMedal(score, maxdelta);   // 111059

        if (nextProfile == null && nextMedal == null)
        {
            callback(true);
            return;
        }

        string confirmStr = string.Empty;

        if (nextMedal != null)
        {
            var scoreDelta = nextMedal.startScore - score;
            var strformat  = LocalizationService.Get(111059);
            confirmStr = string.Format(strformat, Profile.Nickname, nextMedal.name, scoreDelta);
        }
        else
        {
            var scoreDelta = nextProfile.score - score;
            var strformat  = LocalizationService.Get(111058);
            confirmStr = string.Format(strformat, Profile.Nickname, nextProfile.nickname, scoreDelta);
        }

        Game.Instance.OpenPopup <Popup_Confirm>().Setup(confirmStr, true, true, ok => callback(ok)).GetComponent <UiCharacter>(true, true).SetBody(1).SetFace(2);
    }