예제 #1
0
    public void SendCreateGameRequest(RoundSetting roundSetting)
    {
        string           roundSettingXml = PureXmlTool.Serializer <RoundSetting>(roundSetting);
        OperationRequest opRequest       = new OperationRequest()
        {
            Parameters = new Dictionary <byte, object>(), OperationCode = (byte)OperationCode.CreateGame
        };

        opRequest.Parameters.Add(opRequest.OperationCode, roundSettingXml);
        createGameRequest.OnOperationRequest(opRequest);
    }
예제 #2
0
        public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, Client curClient)
        {
            string       roundSettingXml = (string)PureDictTool.GetValue <byte, object>(operationRequest.Parameters, operationRequest.OperationCode);
            RoundSetting rs = PureXmlTool.Deserializer <RoundSetting>(roundSettingXml);

            PureGameServer._instance.RoundSetting = rs;
            curClient.playerData.UserName         = rs.HostName;
            curClient.playerData.IsHost           = true;
            curClient.playerData.GamingStatus     = InGamingStatus.Stay;
            curClient.playerData.ClientStatus     = ClientStatusCode.Gaming;

            curClient.SendOperationResponse(new OperationResponse(operationRequest.OperationCode), sendParameters);
        }
예제 #3
0
    void OnStartClick()
    {
        if (PanelManager.Instance.inGamingMember != 0)
        {
            GameObject g = Instantiate(Resources.Load("Prefab/UI/TipMessage") as GameObject, PanelManager.Instance.GetComponent <RectTransform>());
            g.GetComponent <FloatTipMessage>().SetText("请直接加入游戏");
            return;
        }
        //将上述信息传递至服务器,关闭其他玩家新建游戏按钮
        RoundSetting rs = new RoundSetting();

        rs.ShopTime   = float.Parse(shopTimeInput.text);
        rs.StartMoney = int.Parse(startMoneyInput.text);
        rs.MapName    = mapNameText.text;
        rs.HostName   = playerNameInput.text;
        RequestSender.Instance.SendCreateGameRequest(rs);
        PanelManager.Instance.newGamePanel.gameObject.SetActive(false);
    }