Exemple #1
0
        public static void WriteLoginData(int value)
        {
            string path = GDFunc.GetPersistentPath("com.lzq.Gr_Login");

            string text = "" + value;

            GDFunc.DeleteFile(path, "LoginInfo.txt");
            GDFunc.CreateFile(path, "LoginInfo.txt", text);
        }
Exemple #2
0
 public static bool ReturnToHall()
 {
     if (GDFunc.OpenPackage("com.lzq.Gr_Login"))
     {
         WriteLoginData(1);
         Application.Quit();
         return(true);
     }
     return(false);
 }
Exemple #3
0
        public void SavePlayerInfo()
        {
            PlayerInfo playerInfo = DataCenter.Instance.gamedata.playerInfo;

            PlayerPrefs.SetString("WX_Name", playerInfo.WXName);
            PlayerPrefs.SetString("WX_ID", playerInfo.WXID);
            //GDFunc.SaveJpg(playerInfo.WXTX_Texture, Application.persistentDataPath + "/" + GD.HEAD_ICON_NAME + ".jpg");
            GDFunc.SaveBytes(playerInfo.WXTX_Datas, Application.persistentDataPath + "/" + GD.HEAD_ICON_NAME);
            PlayerPrefs.Save();
        }
Exemple #4
0
        private Vector3 GetHeadWorldPos()
        {
            Transform headTrans    = GameUtility.FindDeepChild(this.gameObject, "HeadIcon");
            Vector3   pos          = UICamera.currentCamera.WorldToViewportPoint(headTrans.position);
            Vector3   headWorldPos = GDFunc.NGUIPosToWorld(headTrans.gameObject);

            headWorldPos   = Camera.main.ViewportToWorldPoint(pos);
            headWorldPos.z = -Camera.main.transform.position.z;
            return(headWorldPos);
        }
Exemple #5
0
        private void AddPanel(PanelType type, string prefabPath, Panel_Depth depth = Panel_Depth.Zero)
        {
            GameObject prefab = ResourcesManager.GetGameObject(prefabPath);

            if (prefab)
            {
                GameObject panelGO = GDFunc.CreateGameObject(prefab, transform);
                AddPanel(type, panelGO.GetComponent <UIPanelBase>(), depth);
            }
            else
            {
                Debuger.LogError("ViewCenter AddPanel() Error !");
            }
        }
Exemple #6
0
        public bool ReadPlayerInfo()
        {
            PlayerInfo playerInfo = DataCenter.Instance.gamedata.playerInfo;

            playerInfo.WXName = PlayerPrefs.GetString("WX_Name", "");
            playerInfo.WXID   = PlayerPrefs.GetString("WX_ID", "");
            if (playerInfo.WXName != "" && playerInfo.WXID != "")
            {
                playerInfo.WXTX_Icon_SpriteName = GD.HEAD_ICON_NAME;
                //playerInfo.WXTX_Texture = GDFunc.Instance.ReadTexture("file:///"+Application.persistentDataPath + "/" + GD.HEAD_ICON_NAME + ".jpg");
                playerInfo.WXTX_Texture.name = GD.HEAD_ICON_NAME;
                //playerInfo.WXTX_Datas = playerInfo.WXTX_Texture.EncodeToJPG();
                playerInfo.WXTX_Datas = GDFunc.ReadBytes(Application.persistentDataPath + "/" + GD.HEAD_ICON_NAME);
                playerInfo.WXTX_Texture.LoadImage(playerInfo.WXTX_Datas);
                DynamicAtlas.Instance.AddTexture(playerInfo.WXTX_Texture);
                return(true);
            }
            return(false);
        }
Exemple #7
0
        private void InitDialogueItems()
        {
            ShowDialogue(true);
            UIGrid grid = GameUtility.FindDeepChild(gameObject, "Dialogue_Items").GetComponent <UIGrid>();

            List <Transform> childList = grid.GetChildList();

            for (int i = 0; i < childList.Count; i++)
            {
                grid.RemoveChild(childList[i]);
                childList[i].gameObject.SetActive(false);
            }

            for (int i = 0; i < Tags.Audio_Name.Chat.Boy_Chat.Length; i++)
            {
                GameObject go = GDFunc.CreateGameObject(DialogueItemObj, grid.transform);
                go.GetComponentInChildren <UILabel>().text = Tags.Audio_Name.Chat.Boy_Chat[i];
                UIEventListener.Get(go).onClick            = delegate
                {
                    OnClickDialogue(go);
                };
                grid.AddChild(go.transform);
            }
        }
Exemple #8
0
        // Update is called once per frame
        void Update()
        {
            ExitGameLogic();

            if (Input.GetKeyDown(KeyCode.Q))
            {
                //StartRecording();
                MicrophoneInput.getInstance().StartRecord();
            }
            if (Input.GetKeyDown(KeyCode.W))
            {
                //EndRecording();
                MicrophoneInput.getInstance().StopRecord();
                byte[] dataBuf = MicrophoneInput.getInstance().GetClipData();
                Debuger.Log("录间数据长度:" + dataBuf.Length);
                byte[] pressBuf = DataZipCenter.CompressByGZIP(dataBuf);
                Debuger.Log("压缩后数据长度:" + pressBuf.Length);
                //MicrophoneInput.getInstance().PlayRecord();
                byte[] depressBuf = DataZipCenter.DeCompressByGZIP(pressBuf);
                Debuger.Log("解压后数据长度:" + depressBuf.Length);
                MicrophoneInput.getInstance().PlayClipData(depressBuf);
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                ////ViewCenter.Instance.GetPanel<Panel_UI>(PanelType.UIManager).Show_胡();
                ////ViewCenter.Instance.GetPanel<Panel_Prompt>(PanelType.Prompt).ShowText("小李子,在干啥呢?");
                ////ViewCenter.Instance.GetPanel<Panel_MessageBox>(PanelType.MessageBox).ShowMessageBox("开始游戏了!", "", null);
                //GameOverData pd = DataCenter.Instance.players[0].gameOver;
                //pd.huTypeList.Add(HuType.平胡);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd = DataCenter.Instance.players[3].gameOver;
                //pd.huTypeList.Add(HuType.平胡);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //pd.ZhongYuList.Add(MJType.条_1);
                //ViewCenter.Instance.ShowPanel<UIPanelBase>(PanelType.GameOver);
            }
            else if (Input.GetKeyDown(KeyCode.Return))
            {
                DataCenter.Instance.players[0].resultList.Clear();
                Result_Struct result = new Result_Struct();
                result.type = ResultType.碰;
                result.MJList.Add(MJType.MJ_北);
                result.MJList.Add(MJType.MJ_北);
                result.MJList.Add(MJType.MJ_北);
                DataCenter.Instance.players[0].resultList.Add(result);
                result      = new Result_Struct();
                result.type = ResultType.吃;
                result.MJList.Add(MJType.万_1);
                result.MJList.Add(MJType.万_2);
                result.MJList.Add(MJType.万_3);
                DataCenter.Instance.players[0].resultList.Add(result);
                result      = new Result_Struct();
                result.type = ResultType.吃;
                result.MJList.Add(MJType.万_2);
                result.MJList.Add(MJType.万_3);
                result.MJList.Add(MJType.万_4);
                DataCenter.Instance.players[0].resultList.Add(result);
                //result = new Result_Struct();
                //result.type = ResultType.杠;
                //result.MJList.Add(MJType.万_2);
                //DataCenter.Instance.players[0].resultList.Add(result);
                ViewCenter.Instance.GetPanel <Panel_Player_Bottom>(PanelType.Player_BOTTOM).UpdateResultBtn(DataCenter.Instance.players[0].resultList);
                //ViewCenter.Instance.GetPanel<Panel_Player_Bottom>(PanelType.Player_BOTTOM).ShowResultMJ(DataCenter.Instance.players[0].resultList, ResultType.吃);
            }

            if (Input.GetKeyDown(KeyCode.Y))
            {
                //DealCommand.Instance.SendLogin("浮夸");

                //List<Texture> texList = new List<Texture>();
                //texList.Add(ResourcesManager.GetTexture("XT"));
                //texList.Add(ResourcesManager.GetTexture("fankui"));
                //CreateAtlas.CreatAtlasFromTex(ResourcesManager.GetAtlas(Tags.MJ_DynamicAtlas), texList);
                //CreateAtlas.CreatAtlasFromTex(ResourcesManager.GetAtlas(Tags.MJ_DynamicAtlas), texList);
                //DataCenter.Instance.players[0].playerInfo.WXTX_Icon_SpriteName = "fankui";
                //DataCenter.Instance.players[1].playerInfo.WXTX_Icon_SpriteName = "XT";
                //DataCenter.Instance.players[2].playerInfo.WXTX_Icon_SpriteName = "fankui";
                //DataCenter.Instance.players[3].playerInfo.WXTX_Icon_SpriteName = "XT";
            }
            if (Input.GetKeyDown(KeyCode.T))
            {
                //Texture2D texture = ResourcesManager.GetTexture("XT");
                //byte[] dataBuf = texture.EncodeToJPG();
                //DealCommand.Instance.SendWXTX(dataBuf.Length, dataBuf);

                //ResDownLoadCenter.Instance.DownLoad("http://wx.qlogo.cn/mmopen/nJZe5ZQpplkuvhlrg9n2hwFyVBwfuCHGuHJia0YX73xTNykkAmE5UNNshicZy5eyBOgj967ibPa7zQEzibpNr4gZQT4ZAibzDkrSq/0", DownLoadResType.Image, ImageDownLoadCall);
                DealCommand.Instance.SendGETTX();
            }
            if (Input.GetKeyDown(KeyCode.U))
            {
                HistroyRecordData hr = new HistroyRecordData();
                hr.WXName_东   = "东";
                hr.WinScore_东 = -100;
                hr.WXName_南   = "南";
                hr.WinScore_南 = 100;
                hr.WXName_西   = "西";
                hr.WinScore_西 = 0;
                hr.WXName_北   = "北";
                hr.WinScore_北 = 10;

                ////DataCenter.Instance.histroyRecordList.Add(hr);
                ViewCenter.Instance.GetPanel <Panel_Record>(PanelType.Record).AddHistoryRecord(ref hr);
                //ViewCenter.Instance.ShowPanel<UIPanelBase>(PanelType.GameOver_Record);
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_BOTTOM).ShowAnim(ResultType.糊);
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_RIGHT).ShowAnim(ResultType.吃);
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_TOP).ShowAnim(ResultType.碰);
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_LEFT).ShowAnim(ResultType.杠);

                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_BOTTOM).ShowMsg_Face("face_00");
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_RIGHT).ShowMsg_Face("face_01");
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_TOP).ShowMsg_Face("face_02");
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_LEFT).ShowMsg_Face("face_03");

                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_BOTTOM).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差");
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_RIGHT).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差");
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_TOP).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差");
                //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_LEFT).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差");

                string ip = "", area = "", networkOperator = "";
                if (GDFunc.GetPublicIPAddress(ref ip, ref area, ref networkOperator))
                {
                    Debuger.Log("IP:" + ip + "----" + area + "----" + networkOperator);
                }
            }
        }