Пример #1
0
    //对比版本虚
    public void compareVersion()
    {
        int currentVerCode;       //当前版本号数字
        int serverVerCode;        //服务器上版本号数字

        currentVersion = currentVersion.Replace(".", "");
        currentVerCode = int.Parse(currentVersion);
        Version123 versionTemp = new Version123();        //版本信息

        //versionTemp = serviceVersionVo.Android;
        if (Application.platform == RuntimePlatform.Android)
        {
            versionTemp = serviceVersionVo.Android;
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            versionTemp = serviceVersionVo.ios;
        }

        if (versionTemp != null && versionTemp.version != null)
        {
            serverVersion = versionTemp.version;
            serverVersion = serverVersion.Replace(".", "");
            serverVerCode = int.Parse(serverVersion);
            if (serverVerCode > currentVerCode)              //服务器上有新版本
            {
                string note = versionTemp.note;
                downloadPath = versionTemp.url;

                TipsManager.getInstance().loadDialog("发现新版本软件", note, onSureClick, onCancle);
            }
        }
    }
Пример #2
0
    public void onCreateRoomResponse(ClientResponse response)
    {
        MyDebug.Log(response.message);
        if (response.status == 1)
        {
            int roomid = Int32.Parse(response.message);
            roomVO.roomId = roomid;
            GlobalData.getInstance().roomVO = roomVO;
            GlobalData.getInstance().myAvatarVO.main = true;
            GlobalData.getInstance().myAvatarVO.isOnLine = true;

            GlobalData.getInstance().remainRoundCount = roomVO.roundNumber;

            List <AvatarVO> avatarList = new List <AvatarVO> ();
            avatarList.Add(GlobalData.getInstance().myAvatarVO);
            GlobalData.getInstance().playerList = avatarList;

            SceneManager.getInstance().changeToScene(SceneType.GAME);


            onClickBtn_Close();
        }
        else
        {
            TipsManager.getInstance().setTips(response.message);
        }
    }
Пример #3
0
    public bool isTel   = false;        // 用于标记特殊物体 电话

    public virtual void init(StuffEventSystem eventSystem, HumanSystem player)
    {
        _player      = player;
        _eventSystem = eventSystem;
        _timer       = TimeLine.getInstance();
        _eventState  = EventState.Stop;
        _audio       = AudioSystem.getInstance();
        _tips        = TipsManager.getInstance();
    }
 public void startTurn()
 {
     if (GlobalData.getInstance().myAvatarVO.account.prizecount > 0)
     {
         GameManager.getInstance().Server.requset(APIS.LOTTERY_REQUEST, "1");
     }
     else
     {
         TipsManager.getInstance().setTips("对不起,抽奖次数不足");
     }
 }
Пример #5
0
 /***
  * 打开进入房间的对话框
  *
  */
 public void openEnterRoomDialog()
 {
     if (GlobalData.getInstance().roomVO == null || GlobalData.getInstance().roomVO.roomId == 0)
     {
         loadPerfab("Prefab/home/Panel_EnterRoomUI");
     }
     else
     {
         TipsManager.getInstance().setTips("当前正在房间状态,无法加入新的房间");
     }
 }
Пример #6
0
 /***
  * 打开创建房间的对话框
  *
  */
 public void openCreateRoomDialog()
 {
     if (GlobalData.getInstance().roomVO.roomId == 0)
     {
         loadPerfab("Prefab/home/Panel_CreateRoomUI");
     }
     else
     {
         TipsManager.getInstance().setTips("当前正在房间状态,无法创建房间");
     }
 }
Пример #7
0
 private void createRoom(RoomVO roomVO, int roomCardNum)
 {
     if (GlobalData.getInstance().myAvatarVO.account.roomcard >= roomCardNum)
     {
         roomVO.roundNumber = roomCardNum * 8;
         GameManager.getInstance().Server.requset(APIS.CREATEROOM_REQUEST, JsonMapper.ToJson(roomVO));
     }
     else
     {
         TipsManager.getInstance().setTips("你的房卡数量不足,不能创建房间");
     }
 }
Пример #8
0
 public void OnPointerDown()
 {
     if (myScript.avatarList != null && myScript.avatarList.Count > 1)
     {
         btnDown = true;
         InputGameObject.SetActive(true);
         MicroPhoneInput.getInstance().StartRecord(getUserList());
     }
     else
     {
         TipsManager.getInstance().setTips("房间里只有你一个人,不能发送语音");
     }
 }
Пример #9
0
    public void onJoinRoomResponse(ClientResponse response)
    {
        if (response.status == 1)
        {
            RoomJoinResponseVo vo = JsonMapper.ToObject <RoomJoinResponseVo> (response.message);
            GameManager.getInstance().DataMgr.updateRoomVO(vo);

            SceneManager.getInstance().changeToScene(SceneType.GAME);
            closeDialog();
        }
        else
        {
            TipsManager.getInstance().setTips(response.message);
        }
    }
Пример #10
0
    public void sureRoomNumber()
    {
        if (inputChars.Count != 6)
        {
            TipsManager.getInstance().setTips("请先完整输入房间号码!");
            return;
        }

        String roomNumber = inputChars[0] + inputChars[1] + inputChars[2] + inputChars[3] + inputChars[4] + inputChars[5];

        RoomJoinVo roomJoinVo = new  RoomJoinVo();

        roomJoinVo.roomId = int.Parse(roomNumber);
        string sendMsg = JsonMapper.ToJson(roomJoinVo);

        GameManager.getInstance().Server.requset(APIS.JOIN_ROOM_REQUEST, sendMsg);
    }
Пример #11
0
    void Start()
    {
        foreach (Transform tran in turnTable.GetComponentsInChildren <Transform>())
        {
            if (tran.name == "pointer")
            {
                pointer = tran.gameObject;
            }
            else if (tran.name == "background")
            {
                background = tran.gameObject;
            }
        }

        _pressureBarHandle = pressureHandle.GetComponent <Image>();
        _heartHandle       = heartHandle.GetComponent <Image>();
        _tips = TipsManager.getInstance();
    }
    public void giftResponse(ClientResponse response)
    {
        callBack = true;
        JsonData data = JsonMapper.ToObject <JsonData> (response.message);

        if (int.Parse(data ["type"].ToString()) == 2)
        {
            TipsManager.getInstance().setTips("抽奖活动暂时没有开放,3秒后将关闭对话框");
            Invoke("closeDialog", 3f);
        }
        else
        {
            try {
                list = JsonMapper.ToObject <GiftList> (response.message);
                if (list.type == "0")
                {
                    for (int i = 0; i < list.data.Count; i++)
                    {
                        GiftItemVO gvo = list.data [i];
                        lotteryItems [i].setData(gvo);
                    }
                }
            } catch (Exception e) {
                Debug.Log(e.ToString());
                if (GlobalData.getInstance().myAvatarVO.account.prizecount > 0)
                {
                    GlobalData.getInstance().myAvatarVO.account.prizecount--;
                    choujiangNum.text = GlobalData.getInstance().myAvatarVO.account.prizecount + "";
                }
                Drawl returndata = JsonMapper.ToObject <Drawl> (response.message);
                StopIndex = returndata.data;
                MyDebug.Log("StopIndex" + StopIndex);
                if (action == false)
                {
                    float a = UnityEngine.Random.Range(-2, 2f);
                    end = Math.Abs(StopIndex * 36 - 34 + a);
                    MyDebug.Log("end = " + end);
                    x        = 0;
                    action   = true;
                    callBack = true;
                }
            }
        }
    }
Пример #13
0
    public void reStratGame()
    {
        if (GlobalData.isOverByPlayer)
        {
            TipsManager.getInstance().setTips("房间已解散,不能重新开始游戏");
            return;
        }

        if (GlobalData.getInstance().remainRoundCount > 0)
        {
            GameManager.getInstance().Server.requset(APIS.READY_REQUEST, "ss");
            //TODO 这个后面要补一下 gameview.markselfReadyGame
            closeDialog();
        }
        else
        {
            TipsManager.getInstance().setTips("游戏局数已经用完,无法重新开始游戏");
        }
    }
Пример #14
0
    public void login()
    {
        InputField ipInput = transform.FindChild("IP").GetComponent <InputField> ();

        if (ipInput.text != "")
        {
            Constants.IP = ipInput.text;
            Constants.UPDATE_INFO_JSON_URL = "http://" + Constants.IP + ":8080/download/update.xml";
            Constants.chatSocketUrl        = Constants.IP;
            Constants.socketUrl            = Constants.IP;
            Constants.PIC_PATH             = "http://" + Constants.IP + ":8080/";
            Constants.ImgUrl       = "http://" + Constants.IP + ":8080/MaJiangManage/images";
            Constants.Download_URL = "http://" + Constants.IP + ":8080/download/index.html";
        }

        InputField uinInput = transform.FindChild("uin").GetComponent <InputField> ();

        if (!GameManager.getInstance().Server.Connected)
        {
            GameManager.getInstance().Server.connect();
            TipsManager.getInstance().setTips("正在连接服务器...");
            return;
        }

        GlobalData.getInstance().reinitData();         //初始化界面数据
        if (agreeToggle.isOn)
        {
            if (uinInput.text != "")
            {
                GameManager.getInstance().WechatAPI.testLogin(uinInput.text);
                watingPanel.SetActive(true);
            }
            else
            {
                TipsManager.getInstance().setTips("请先输入QQ号");
            }
        }
        else
        {
            TipsManager.getInstance().setTips("请先同意用户使用协议");
        }
    }
Пример #15
0
    public void login()
    {
        if (!GameManager.getInstance().Server.Connected)
        {
            GameManager.getInstance().Server.connect();
            TipsManager.getInstance().setTips("正在连接服务器...");
            return;
        }

        GlobalData.getInstance().reinitData();         //初始化界面数据
        if (agreeToggle.isOn)
        {
            GameManager.getInstance().WechatAPI.login();
            watingPanel.SetActive(true);
        }
        else
        {
            TipsManager.getInstance().setTips("请先同意用户使用协议");
        }
    }
Пример #16
0
    private string downloadPath;                                     //应用下载链接

    /**
     * 检测升级
     */
    public IEnumerator  updateCheck()
    {
        WWW www = new WWW(Constants.UPDATE_INFO_JSON_URL);

        yield return(www);

        byte[] buffer = www.bytes;

        if (string.IsNullOrEmpty(www.error))
        {
            string returnxml = System.Text.Encoding.UTF8.GetString(buffer);
            MyDebug.Log("returnxml  =  " + returnxml);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(returnxml);
            XmlNodeList nodeList = xmlDoc.SelectNodes("versions/version");
            foreach (XmlNode xmlNodeVersion in nodeList)
            {
                Version123 temp = new Version123();
                temp.title   = xmlNodeVersion.SelectSingleNode("title").InnerText;
                temp.url     = xmlNodeVersion.SelectSingleNode("url").InnerText;
                temp.note    = xmlNodeVersion.SelectSingleNode("note").InnerText;
                temp.version = xmlNodeVersion.SelectSingleNode("versionname").InnerText;
                XmlElement xe = (XmlElement)xmlNodeVersion;
                if (xe.GetAttribute("id") == "ios")
                {
                    serviceVersionVo.ios      = temp;
                    serviceVersionVo.ios.url += "l=zh&mt=8";
                }
                else if (xe.GetAttribute("id") == "android")
                {
                    serviceVersionVo.Android = temp;
                }
            }
            compareVersion();
        }
        else
        {
            TipsManager.getInstance().setTips("更新文件加载失败");
        }
    }
Пример #17
0
    void onResponse(ClientResponse response)
    {
        InputField roomIDInput = transform.FindChild("roomID").GetComponent <InputField> ();

        switch (response.headCode)
        {
        case APIS.LOGIN_RESPONSE:        //登录回包
            if (roomIDInput.text != "")
            {
                RoomJoinVo roomJoinVo = new  RoomJoinVo();
                roomJoinVo.roomId = int.Parse(roomIDInput.text);
                string sendMsg = JsonMapper.ToJson(roomJoinVo);
                GameManager.getInstance().Server.requset(APIS.JOIN_ROOM_REQUEST, sendMsg);
            }
            else
            {
                onLoginResponse(response);
            }
            break;

        case APIS.BACK_LOGIN_RESPONSE:        //掉线登录回包
            onBackLoginResponse(response);
            break;

        case APIS.JOIN_ROOM_RESPONSE:        //加入房间
            if (response.status == 1)
            {
                RoomJoinResponseVo vo = JsonMapper.ToObject <RoomJoinResponseVo> (response.message);
                GameManager.getInstance().DataMgr.updateRoomVO(vo);

                SceneManager.getInstance().changeToScene(SceneType.GAME);
            }
            else
            {
                TipsManager.getInstance().setTips(response.message);
            }
            break;
        }
    }
Пример #18
0
    private void onLoginResponse(ClientResponse response)
    {
        watingPanel.SetActive(false);

        SoundManager.getInstance().playBGM();
        if (response.status == 1)
        {
            GlobalData.getInstance().myAvatarVO = JsonMapper.ToObject <AvatarVO> (response.message);

            var request = new ChatRequest();
            request.headCode = APIS.LoginChat_Request;
            request.userList = new List <int> ();
            request.userList.Add(GlobalData.getInstance().myAvatarVO.account.uuid);
            GameManager.getInstance().Server.requset(request);

            SceneManager.getInstance().changeToScene(SceneType.HOME);
        }
        else
        {
            TipsManager.getInstance().setTips(response.message);
        }
    }
 private void prizeCountChange()
 {
     TipsManager.getInstance().setTips("您的抽奖次数已经更新");
     choujiangNum.text = GlobalData.getInstance().myAvatarVO.account.prizecount + "";
 }
Пример #20
0
 public SolveEventSystem(HumanSystem person)
 {
     _player      = person;
     _playerStuff = person.getStuffComp();
     _tips        = TipsManager.getInstance();
 }