Esempio n. 1
0
    /// <summary>
    /// 接受游戏反馈消息,并上传id到服务器获取游戏金额
    /// </summary>
    /// <param name="message"></param>
    public void UpdateResult(IMessage message)
    {
        string data = (string)message.Body;

        if (data == "连接到客户端")
        {
            PanelWaiting.gameObject.SetActive(false);
        }
        else
        {
            GUID = Util.GetGUID(); //生成新的GUID
            string result    = "";
            float  sendPrice = 0;
            if (data == "成功")
            {
                sendPrice = goldPrice;
                result    = PostGUID(appId, meachineId, GUID, goldPrice);
            }
            else if (data == "失败")
            {
                sendPrice = 0;
                result    = PostGUID(appId, meachineId, GUID, 0f);
            }
            ServerManager.SendMessageClient("退出"); //关闭游戏
            MediaPlayerMgr.SetVolume(1);
            if (result != string.Empty)
            {
                PostGUID post = JsonMapper.ToObject <PostGUID>(result);
                //生成二维码
                if (post.errCode == 0)
                {
                    UIManager.ShowPanel(PanelType.PanelPay, GUID, sendPrice, true);
                    Close();
                }
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 获取用户信息,判断游戏次数
    /// </summary>
    /// <param name="message"></param>
    private void ReceiveMsg(IMessage message)
    {
        string ReceiveMsg = message.Body.ToString();

        userData = SerializeHelper.DeSerializeJson <UserData>(ReceiveMsg);
        GameManager.m_UserData = userData;
        if (userData != null)
        {
            int times = int.Parse(userData.gametimes);
            if (times > 0)
            {
                LoginGame = true;
                ReSetTime();
                PanelLogin.gameObject.SetActive(false);
                PanelWaiting.gameObject.SetActive(true);
                MediaPlayerMgr.SetVolume(0);
                facade.SendMessageCommand(MessageDef.PlayGame, PlayGameValue);
            }
            else
            {
                Warning.enabled = true;
            }
        }
    }