コード例 #1
0
    //创建按钮点击
    public void OnCreateClick()
    {
        int      len   = mGrid.transform.childCount;
        int      id    = 1;//最终选中的id
        int      index = 0;
        UIToggle t;

        for (int i = 0; i < len; i++)
        {
            t = mGrid.transform.GetChild(i).GetComponent <UIToggle>();
            if (t.value)
            {
                id    = int.Parse(t.name);
                index = i;
                break;
            }
        }
        JinhuaCreateConfig con = mData[index] as JinhuaCreateConfig;

        if (PlayerModel.Inst.UserInfo.gold < con.minScore)
        {
            Global.Inst.GetController <CommonTipsController>().ShowTips("至少需要" + con.minScore + "金币");
            return;
        }
        SendCreateRoomReq req = new SendCreateRoomReq();

        req.baseScore = con.baseScore;
        req.into      = con.minScore;
        req.gameId    = eGameType.GoldFlower.GetHashCode();
        Global.Inst.GetController <XXGoldFlowerGameController>().SendCreateRoomReq(req);
    }
コード例 #2
0
 /// <summary>
 /// 创建房间
 /// </summary>
 /// <param name="req"></param>
 public void SendCreateRoomReq(SendCreateRoomReq req)
 {
     NetProcess.SendRequest <SendCreateRoomReq>(req, TenProtoIdMap.CMD_SendCreateRoom, (msg) =>
     {
         TenCreateJoinRoomAck ack = msg.Read <TenCreateJoinRoomAck>();
         if (ack.code == 1)
         {
             ServerCreateJoinRoom(ack.data);
         }
         else
         {
             GameUtils.ShowErrorTips(ack.code);
         }
     });
 }
コード例 #3
0
 /// <summary>
 /// 创建房间
 /// </summary>
 /// <param name="req"></param>
 public void SendCreateRoomReq(SendCreateRoomReq req)
 {
     NetProcess.SendRequest <SendCreateRoomReq>(req, GoldFlowerProtoIdMap.CMD_SendCreateRoom, (msg) =>
     {
         GoldFlowerCreateRoomAck ack = msg.Read <GoldFlowerCreateRoomAck>();
         if (ack.code == 1)
         {
             XXGoldFlowerGameModel.Inst.CleanMode(true);
             ServerCreateJoinGame(ack.data);
         }
         else
         {
             GameUtils.ShowErrorTips(ack.code);
         }
     });
 }
コード例 #4
0
 public void CreateRoom(SendCreateRoomReq req)
 {
     Global.Inst.GetController <GamePatternController>().mView = null;
     NetProcess.SendRequest <SendCreateRoomReq>(req, MJProtoMap.CMD_CreateRoom, (msg) =>
     {
         StartGameBackData data = msg.Read <StartGameBackData>();
         if (data.code == 1)
         {
             //发送位置信息给服务器
             if (PlayerModel.Inst.address != null)
             {
                 NetProcess.SendRequest <SendAddrReq>(PlayerModel.Inst.address, MJProtoMap.CMD_SendAddress, (msgData) =>
                 {
                     SQDebug.Log("gps 返回");
                 }, false);
             }
             HandleStartGameData(data.data);
         }
         else
         {
             GameUtils.ShowErrorTips(data.code);
         }
     });
 }
コード例 #5
0
    /// <summary>
    /// 解析房间规则
    /// </summary>
    /// <param name="roomInfo"></param>
    /// <param name="show"></param>
    /// <returns></returns>
    public string DeserializeRuleJosn(SendCreateRoomReq roomInfo, bool show, bool gold = false)
    {
        string result = "";

        List <ConfigDada> list = null;

        switch ((eGameType)roomInfo.gameId)
        {
        case eGameType.MaJiang:
        {
            list = ConfigManager.GetConfigs <MJGameCreateConfig>();
        }
        break;

        case eGameType.NiuNiu:
        {
            list = ConfigManager.GetConfigs <NiuNiuGameCreateConfig>();
        }
        break;

        case eGameType.GoldFlower:
        {
            list = ConfigManager.GetConfigs <JinHuaGameCreateConfig>();
        }
        break;

        case eGameType.TenHalf:
            list = ConfigManager.GetConfigs <TenGameCreateConfig>();
            break;
        }

        CreateRoomRule config = null;

        for (int i = 0; i < list.Count; i++)
        {
            CreateRoomRule temp = list[i] as CreateRoomRule;
            if (temp.gameId == roomInfo.subType)
            {
                SQDebug.Log(temp.gameId + "::+++++");
                config = temp;
                break;
            }
        }

        if (!show)
        {
            result += config.name + ":";
        }

        for (int i = 0; i < config.rules.Length; i++)
        {
            if (show)
            {
                result += config.rules[i].name + ":";
            }
            bool contain = false;

            Debug.Log("iii=" + i + "  " + config.rules.Length);

            for (int j = 0; j < config.rules[i].content.Length; j++)
            {
                Debug.Log("jjj=" + j);
                if (CheckRule(roomInfo.ruleIndexs, config.rules[i].content[j].Index, config.rules[i].content[j].connect))
                {//包含这个规则
                    result += config.rules[i].content[j].name + ",";
                    contain = true;
                }
                if (config.rules[i].content[j].Index == 1)
                {//底分
                    result += "底分为" + roomInfo.baseScore + ",";
                    contain = true;
                }
                if (config.rules[i].content[j].Index == 2)
                {
                    result += "带入为" + roomInfo.into + ",";
                    contain = true;
                }
            }
            if (!contain && !config.rules[i].name.Contains("模式"))
            {
                result += "无,";
            }
            if (show)
            {
                if (gold && config.rules[i].name.Contains("模式"))
                {
                    result += "平台场,";
                }
                result  = result.Remove(result.Length - 1, 1);//移除最后一位逗号
                result += "\n";
            }
        }
        if (!show)
        {
            result = result.Replace("无,", "");
            result = result.Remove(result.Length - 1, 1);//移除最后一位逗号
        }
        return(result);
    }