Exemple #1
0
 public void Init(Proto.gameInfo gameInfo)
 {
     gameData = gameInfo;
     gameObject.SetActive(true);
     transform.name = gameInfo.id.ToString();
     transform.Find("gameName").GetComponent <Text>().text = gameInfo.gameName;
     transform.Find("gameId").GetComponent <Text>().text   = "ID: " + gameInfo.id;
     transform.Find("roleName").GetComponent <Text>().text = gameInfo.roleName;
     if (gameInfo.state == Proto.gameState.wait)
     {
         transform.Find("time1").GetComponent <Text>().text = "创建时间: " + gameInfo.createTime;
         transform.Find("time2").GetComponent <Text>().text = "开始时间: " + gameInfo.startTime;
     }
     else if (gameInfo.state == Proto.gameState.going)
     {
         transform.Find("time1").GetComponent <Text>().text = "开始时间: " + gameInfo.startTime;
         transform.Find("time2").GetComponent <Text>().text = "结束时间: " + gameInfo.endTime;
     }
     else
     {
         transform.Find("time1").GetComponent <Text>().text = "结束时间: " + gameInfo.endTime;
         transform.Find("time2").GetComponent <Text>().text = "关闭时间: " + gameInfo.closeTime;
     }
 }
Exemple #2
0
 /// <summary>
 /// 显示比赛详细信息面板
 /// </summary>
 public void ShowGameInfo(Proto.gameInfo gameInfo)
 {
     UIManager.instance.ShowPanel(UIPanel.MainScene.AboutGame.gameInfoPanel);
     GameInfoPanel.instance.Init(gameInfo);
 }
Exemple #3
0
    public void Init(Proto.gameInfo tmpGame)
    {
        oneGame = tmpGame;
        SocketClient.AddHandler(Route.info_game_createMatchTable, SVR_createWaitTableRsp);
        SocketClient.AddHandler(Route.info_game_refreshMyRank, SVR_RefreshRankBack);
        SocketClient.AddHandler(Route.info_game_getRankList, SVR_GetRankListBack);

        if (oneGame.state != Proto.gameState.going)
        {
            transform.Find("startGame").gameObject.SetActive(false);
        }
        if (oneGame.state == Proto.gameState.wait)
        {
            transform.Find("rank/rankN/refresh").gameObject.SetActive(false);
        }
        else
        {
            transform.Find("rank/rankN/refresh/cost").GetComponent <Text>().text = "-" + PlayerInfo.refreshMyRankCost + "金币";
            Proto.GetRankListReq msg = new Proto.GetRankListReq();
            msg.gameId  = oneGame.id;
            msg.rankSvr = oneGame.rankServer;
            SocketClient.SendMsg(Route.info_game_getRankList, msg);
        }
        transform.Find("gameName/Text").GetComponent <Text>().text = oneGame.gameName;
        transform.Find("notice/Text").GetComponent <Text>().text   = oneGame.gameNotice;

        transform.Find("rankAward/rank").GetComponent <Text>().text = string.Format("1:\n2:\n3:\n4-{0}:\n" +
                                                                                    "{1}-{2}:", oneGame.award[3].rank, oneGame.award[3].rank + 1, oneGame.award[4].rank);

        transform.Find("rankAward/num").GetComponent <Text>().text = string.Format("{0}\n{1}\n{2}\n{3}\n{4}", oneGame.award[0].num,
                                                                                   oneGame.award[1].num, oneGame.award[2].num, oneGame.award[3].num, oneGame.award[4].num);
        CreateShowPrefab("开始时间:", oneGame.startTime);
        CreateShowPrefab("结束时间:", oneGame.endTime);
        CreateShowPrefab("关闭时间:", oneGame.closeTime);
        CreateShowPrefab("需要密码:", oneGame.password == "" ? "否" : "是");
        CreateShowPrefab("排行人数:", oneGame.rankNum + "人");
        var param     = PlayerInfo.gameTypes[oneGame.gameType].param;
        var paramData = oneGame.gameParam;

        foreach (var one in param)
        {
            Proto.paramType paramType = Proto.paramType.gameTime;
            if (one.uiType == Proto.GameParamUIType.dropdown)
            {
                paramType = JsonUtility.FromJson <I_param_dropdown>(one.data).type;
            }
            else if (one.uiType == Proto.GameParamUIType.input)
            {
                paramType = JsonUtility.FromJson <I_param_input>(one.data).type;
            }
            string showInfo = "";
            switch (paramType)
            {
            case Proto.paramType.gameTime:
                showInfo = paramData.gameTime / 60 + "分钟";
                break;

            case Proto.paramType.stepTime:
                showInfo = paramData.stepTime / 60 + "分钟";
                break;

            case Proto.paramType.countTime:
                showInfo = paramData.countTime + "秒";
                break;

            case Proto.paramType.doorCost:
                showInfo = paramData.doorCost + "豆子";
                break;

            case Proto.paramType.tableCost:
                showInfo = paramData.tableCost + "豆子";
                break;

            case Proto.paramType.baseCost:
                showInfo = paramData.baseCost + "豆子";
                break;

            case Proto.paramType.canRoomChat:
                showInfo = paramData.canRoomChat ? "允许" : "禁止";
                break;

            case Proto.paramType.canInviteFriend:
                showInfo = paramData.canInviteFriend ? "允许" : "禁止";
                break;

            default:
                break;
            }
            if (showInfo != "")
            {
                CreateShowPrefab(PlayerInfo.gameParamName[paramType] + ":", showInfo);
            }
        }
    }