Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Escape))         //Android系统监听返回键,由于只有Android和ios系统所以无需对系统做判断
        {
            if (panelCreateDialog == null)
            {
                panelCreateDialog = Instantiate(Resources.Load("Prefab/Panel_Exit")) as GameObject;
                panelCreateDialog.transform.parent     = gameObject.transform;
                panelCreateDialog.transform.localScale = Vector3.one;
                //panelCreateDialog.transform.localPosition = new Vector3 (200f,150f);
                panelCreateDialog.GetComponent <RectTransform>().offsetMax = new Vector2(0f, 0f);
                panelCreateDialog.GetComponent <RectTransform>().offsetMin = new Vector2(0f, 0f);
            }
        }

#if UNITY_IPHONE
        if (canGuestLogin != GlobalDataScript.inAppPay)
        {
            canGuestLogin = GlobalDataScript.inAppPay;
            agreement.SetActive(!canGuestLogin);
            guestLogin.SetActive(canGuestLogin);
            if (canGuestLogin)
            {
                wechatLogin.SetActive(canWechatLogin);
            }
            else
            {
                wechatLogin.SetActive(true);
            }
        }

        if (canWechatLogin != GlobalDataScript.getInstance().wechatOperate.isWechatValid())
        {
            canWechatLogin = GlobalDataScript.getInstance().wechatOperate.isWechatValid();

            if (canGuestLogin)
            {
                wechatLogin.SetActive(canWechatLogin);
            }
            else
            {
                wechatLogin.SetActive(true);
            }
        }
#endif
    }
    void Start()
    {
        MicroPhoneInput.getInstance();
        GlobalDataScript.getInstance();
        //CustomSocket.getInstance().Connect();
        //ChatSocket.getInstance ();
        TipsManagerScript.getInstance().parent = gameObject.transform;
        SoundCtrl.getInstance();

        //UpdateScript update = new UpdateScript ();
        //StartCoroutine (update.updateCheck ());
        ServiceErrorListener seriveError = new ServiceErrorListener();

        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        //heartbeatTimer ();
        heartbeatThread();
    }
Example #3
0
        public LoginRequest(string openid, string nickname)
        {
            MyDebug.Log("----------------4------------------");
            headCode = APIS.LOGIN_REQUEST;

            LoginVo loginvo = new LoginVo();


            System.Random ran = new System.Random();
            string        str = ran.Next(100, 1000) + "for" + ran.Next(2000, 5000);

            loginvo.openId = openid;
            MyDebug.Log("----------------5------------------");

            loginvo.nickName = nickname;
            loginvo.headIcon = "imgico221";
            loginvo.unionid  = openid;
            loginvo.province = "21sfsd";
            loginvo.city     = "afafsdf";
            loginvo.sex      = 1;
            loginvo.IP       = GlobalDataScript.getInstance().getIpAddress();
            string data = JsonMapper.ToJson(loginvo);

            GlobalDataScript.loginVo                            = loginvo;
            GlobalDataScript.loginResponseData                  = new AvatarVO();
            GlobalDataScript.loginResponseData.account          = new Account();
            GlobalDataScript.loginResponseData.account.city     = loginvo.city;
            GlobalDataScript.loginResponseData.account.openid   = loginvo.openId;
            GlobalDataScript.loginResponseData.account.nickname = loginvo.nickName;
            GlobalDataScript.loginResponseData.account.headicon = loginvo.headIcon;
            GlobalDataScript.loginResponseData.account.unionid  = loginvo.city;
            GlobalDataScript.loginResponseData.account.sex      = loginvo.sex;
            GlobalDataScript.loginResponseData.IP               = loginvo.IP;

            //加载头像
            if (GlobalDataScript.loginVo.sex == 2)
            {
                GlobalDataScript.getInstance().headSprite = Resources.Load("xianlai/public_ui/head_img_female", typeof(Sprite)) as Sprite;
            }
            else
            {
                GlobalDataScript.getInstance().headSprite = Resources.Load("xianlai/public_ui/head_img_male", typeof(Sprite)) as Sprite;
            }

            messageContent = data;
        }
    /**
     * 获取微信个人信息成功回调,登录
     *
     */
    public void getUserInforCallback(int reqID, ResponseState state, PlatformType type, Hashtable data)
    {
        //TipsManagerScript.getInstance ().setTips ("获取个人信息成功");

        if (data != null)
        {
            MyDebug.Log(data.toJson());
            LoginVo loginvo = new LoginVo();
            try {
                loginvo.openId   = (string)data ["openid"];
                loginvo.nickName = (string)data ["nickname"];
                loginvo.headIcon = (string)data ["headimgurl"];
                loginvo.unionid  = (string)data ["unionid"];
                loginvo.province = (string)data ["province"];
                loginvo.city     = (string)data ["city"];
                string sex = data ["sex"].ToString();
                loginvo.sex = int.Parse(sex);
                loginvo.IP  = GlobalDataScript.getInstance().getIpAddress();
                String msg = JsonMapper.ToJson(loginvo);

                CustomSocket.getInstance().sendMsg(new LoginRequest(msg));

                GlobalDataScript.loginVo                          = loginvo;
                GlobalDataScript.loginResponseData                = new AvatarVO();
                GlobalDataScript.loginResponseData.account        = new Account();
                GlobalDataScript.loginResponseData.account.city   = loginvo.city;
                GlobalDataScript.loginResponseData.account.openid = loginvo.openId;
                MyDebug.Log(" loginvo.nickName:" + loginvo.nickName);
                GlobalDataScript.loginResponseData.account.nickname = loginvo.nickName;
                GlobalDataScript.loginResponseData.account.headicon = loginvo.headIcon;
                GlobalDataScript.loginResponseData.account.unionid  = loginvo.city;
                GlobalDataScript.loginResponseData.account.sex      = loginvo.sex;
                GlobalDataScript.loginResponseData.IP = loginvo.IP;
            } catch (Exception e) {
                MyDebug.Log("微信接口有变动!" + e.Message);
                //TipsManagerScript.getInstance ().setTips ("请先打开你的微信客户端");
                TipsManagerScript.getInstance().setTips(data.toJson());
                return;
            }
        }
        else
        {
            TipsManagerScript.getInstance().setTips("微信登录失败");
        }
    }
    void Start()
    {
        thePlayer         = FindObjectOfType <PlayerController>();
        loadNewAreaScript = FindObjectOfType <LoadNewArea>();

        theDM = FindObjectOfType <DialogueManager>();

        playerObject          = GameObject.Find("Player");
        itemSlotManagerScript = FindObjectOfType <ItemSlotManager>();

        playerHealth = playerObject.GetComponent <PlayerHealthManager>();
        globalData   = FindObjectOfType <GlobalDataScript>();

        if (!reloadExists)
        {
            reloadExists = true;
        }
    }
Example #6
0
    public void LoginCallBack(ClientResponse response)
    {
        if (watingPanel != null)
        {
            watingPanel.SetActive(false);
        }

        if (response.handleCode == StatusCode.SESSION_expire ||
            response.handleCode == StatusCode.SESSION_invalid || response.bytes == null)
        {
            return;
        }

        profile_response reponseX = ClientRequest.DeSerialize <profile_response>(response.bytes);

        Debug.Log("logincallback: " + reponseX.data.nickname);
        GlobalDataScript.playerInfo = reponseX.data;

        SoundCtrl.getInstance().stopBGM();
        SoundCtrl.getInstance().playBGM();

        if (GlobalDataScript.homePanel != null)
        {
            GlobalDataScript.homePanel.GetComponent <HomePanelScript>().removeListener();
            Destroy(GlobalDataScript.homePanel);
        }

        if (GlobalDataScript.gamePlayPanel != null)
        {
            GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript>().exitOrDissoliveRoom();
        }

//		GlobalDataScript.loginResponseData = JsonMapper.ToObject<AvatarVO>(response.message);
//		ChatSocket.getInstance().sendMsg(new LoginChatRequest(GlobalDataScript.loginResponseData.account.uuid));
        panelCreateDialog = Instantiate(Resources.Load("Prefab/Panel_Home")) as GameObject;
        panelCreateDialog.transform.parent     = GlobalDataScript.getInstance().canvsTransfrom;
        panelCreateDialog.transform.localScale = Vector3.one;
        panelCreateDialog.GetComponent <RectTransform>().offsetMax = new Vector2(0f, 0f);
        panelCreateDialog.GetComponent <RectTransform>().offsetMin = new Vector2(0f, 0f);
        GlobalDataScript.homePanel = panelCreateDialog;
        removeListener();
        Destroy(this);
        Destroy(gameObject);
    }
Example #7
0
    public void loginWechat()
    {
        SoundCtrl.getInstance().playSoundUI(true);

        if (!CustomSocket.getInstance().isConnected)
        {
            CustomSocket.getInstance().Connect();
            ChatSocket.getInstance().Connect();
            tapCount = 0;
            return;
        }

        GlobalDataScript.reinitData();        //初始化界面数据
        if (agreeProtocol.isOn)
        {
//			doLogin();
            if (Application.platform == RuntimePlatform.OSXEditor ||
                Application.platform == RuntimePlatform.WindowsEditor)
            {
                WeChatLoginCallBack("{\"access_token\":" +
                                    "\"BYl9EIcjwyVFdP3F8ZIo8_OrDlMi4MNKFRDGdl_3KkmtU5YLl7Vgi4dw17I24tS2af2CqhBX6X3p9R5emnZOen8SvuFkNn5_wd4042L3d2w\"," +
                                    "\"expires_in\":7200," +
                                    "\"refresh_token\":" +
                                    "\"BQhqiKHK_cUnED8a1CfRgUcXuS4EyGcq9XQAdj-N-3ctMUoG6VxzTROBIe7m1Q2Ws17br6MJxk85tIbMz4ecsI1VEXsfslh9jyWN1Xjt6vc\"," +
                                    "\"openid\":\"o3LILj-8xTgvce2P_QBjMrgDZdQg\"," +
                                    "\"scope\":\"snsapi_userinfo\"," +
                                    "\"unionid\":\"oHRAHuO86ExIL6tLdyAkFSFlEoYw\"}");
            }
            else
            {
                PlatformBridge.Instance.doWeChatLogin();
                watingPanel.SetActive(true);
            }
        }
        else
        {
            MyDebug.Log("请先同意用户使用协议");
            TipsManagerScript.getInstance().setTips("请先同意用户使用协议");
        }

        tapCount += 1;
        Invoke("resetClickNum", 10f);
    }
Example #8
0
 private void isConnected()
 {
     if (CustomSocket.getInstance().isConnected)
     {
         watingPanel.SetActive(false);
         this.CancelInvoke(); //取消定时器的执行
                              //如果已经授权自动登录
         #if UNITY_ANDROID
         if (GlobalDataScript.getInstance().wechatOperate.shareSdk.IsAuthorized(PlatformType.WeChat))
         {
             login();
         }
         #elif UNITY_IPHONE
         if (GlobalDataScript.getInstance().wechatOperate.shareSdk.IsAuthorized(PlatformType.WechatPlatform))
         {
             login();
         }
         #endif
     }
 }
Example #9
0
    void Update()
    {
        cooldownRemaining -= Time.deltaTime;

        if (commitingCrime)
        {
            if (agent.remainingDistance <= 1f)
            {
                commitingCrime     = false;
                currentCrimeScript = null;
            }
        }
        else
        {
            if (agent.hasPath != true)
            {
                GlobalDataScript.MoveToWayPoint(gameObject);
            }
        }
    }
Example #10
0
    void AnswerQuestion()
    {
        int answerChoice = honesty * communism - communism - 45;

        if (isWitness)
        {
            answerChoice += 10;
        }
        if (answerChoice > 15)
        {
            if (answerChoice > 30)
            {
                ClueDataClass witnessClue = ScriptableObject.CreateInstance("ClueDataClass") as ClueDataClass;
                witnessClue.Init(gameObject, GlobalDataScript.PickRandomTrait(GameManager.currentPerpetrator.GetComponent <AIScript> ()));
                GameManager.currentPerpetrator.GetComponent <AIScript> ().IncreaseEmission(3);
                witnessClue.clueDossierEntry = name + " accuses " + GameManager.currentPerpetrator.name + " of committing the " + GameManager.currentCrime.crimeName;
                GameManager.currentCrime.crimeClues.Add(witnessClue);
            }
            else
            {
                Debug.Log(gameObject.name + " was interrogated");
                ClueDataClass witnessClue = ScriptableObject.CreateInstance("ClueDataClass") as ClueDataClass;
                witnessClue.Init(gameObject, GlobalDataScript.PickRandomTrait(GameManager.currentPerpetrator.GetComponent <AIScript> ()));
                GameManager.currentPerpetrator.GetComponent <AIScript> ().IncreaseEmission(1);
                GameManager.currentCrime.crimeClues.Add(witnessClue);
                Debug.Log(witnessClue.clueDossierEntry);
                Debug.Log(GameManager.currentCrime.crimeName);
            }
        }
        else
        {
            Debug.Log(gameObject.name + " was interrogated");
            ClueDataClass witnessClue = ScriptableObject.CreateInstance("ClueDataClass") as ClueDataClass;
            witnessClue.Init(gameObject, GlobalDataScript.PickRandomTrait(GameManager.currentPerpetrator.GetComponent <AIScript> ()));
            GameManager.currentPerpetrator.GetComponent <AIScript> ().IncreaseEmission(0);
            witnessClue.clueDossierEntry = name + " doesn't appear to know anything at all";
            GameManager.currentCrime.crimeClues.Add(witnessClue);
            Debug.Log(witnessClue.clueDossierEntry);
            Debug.Log(GameManager.currentCrime.crimeName);
        }
    }
Example #11
0
    /// <summary>
    /// 加载头像
    /// </summary>
    /// <returns>The image.</returns>
    private IEnumerator LoadImg()
    {
        if (avatarvo.account.headicon.IndexOf("http") == -1)
        {
            ShowOrDisShowHeadImage(1);
            headerIcon.sprite = GlobalDataScript.getInstance().headSprite;
            yield break;
        }

        if (FileIO.wwwSpriteImage.ContainsKey(avatarvo.account.headicon))
        {
            ShowOrDisShowHeadImage(1);
            headerIcon.sprite = FileIO.wwwSpriteImage[avatarvo.account.headicon];
            yield break;
        }

        //开始下载图片
        WWW www = new WWW(avatarvo.account.headicon);

        yield return(www);

        //下载完成,保存图片到路径filePath
        if (www != null)
        {
            Texture2D texture2D = www.texture;
            byte[]    bytes     = texture2D.EncodeToPNG();

            //将图片赋给场景上的Sprite
            Sprite tempSp = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), new Vector2(0, 0));

            ShowOrDisShowHeadImage(1);

            headerIcon.sprite = tempSp;
            FileIO.wwwSpriteImage.Add(avatarvo.account.headicon, tempSp);
        }
        else
        {
            MyDebug.Log("没有加载到图片");
        }
    }
Example #12
0
    public void LoginCallBack(ClientResponse response)
    {
        if (watingPanel != null)
        {
            watingPanel.SetActive(false);
        }

        // SoundCtrl.getInstance().playBGM();
        if (response.status == 1)
        {
            if (GlobalDataScript.homePanel != null)
            {
                // TODO
                GlobalDataScript.homePanel.GetComponent <HomePanelScript>().removeListener();
                Destroy(GlobalDataScript.homePanel);
            }
        }

        if (GlobalDataScript.gamePlayPanel != null)
        {
            // TODO
            GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript>().exitOrDissoliveRoom();
        }
        Debug.Log("收到服务端返回数据-->" + response.message);
        GlobalDataScript.loginResponseData = JsonMapper.ToObject <AvatarVO>(response.message);
        Debug.Log("对象接受-->" + JsonMapper.ToJson(GlobalDataScript.loginResponseData));

        // 加载游戏主界面 TODO
        panelCreateDialog = Instantiate(Resources.Load("Prefab/Panel_Home")) as GameObject;
        panelCreateDialog.transform.parent = GlobalDataScript.getInstance().canvsTransfrom;
        // Vector3.one 将panel 中 Scale属性中的 X、Y、Z变成1
        panelCreateDialog.transform.localScale = Vector3.one;
        // Left  Top bottom right 归0
        panelCreateDialog.GetComponent <RectTransform>().offsetMax = new Vector2(0f, 0f);
        panelCreateDialog.GetComponent <RectTransform>().offsetMin = new Vector2(0f, 0f);
        GlobalDataScript.homePanel = panelCreateDialog;
        // removeListener();
        Destroy(this);
        Destroy(gameObject);
    }
Example #13
0
    void Start()
    {
        CustomSocket.getInstance().hasStartTimer = false;
        CustomSocket.getInstance().Connect();
        ChatSocket.getInstance().Connect();
        GlobalDataScript.isonLoginPage = true;
        SocketEventHandle.getInstance().UpdateGlobalData += UpdateGlobalData;
        SocketEventHandle.getInstance().LoginCallBack    += LoginCallBack;
        SocketEventHandle.getInstance().RoomBackResponse += RoomBackResponse;
        versionText.text = "版本号:" + Application.version;

#if UNITY_IPHONE
        canGuestLogin  = GlobalDataScript.inAppPay;
        canWechatLogin = GlobalDataScript.getInstance().wechatOperate.isWechatValid();
        agreement.SetActive(!canGuestLogin);
        guestLogin.SetActive(canGuestLogin);
        if (canGuestLogin)
        {
            wechatLogin.SetActive(canWechatLogin);
        }
#endif
    }
Example #14
0
    /**
     * 获取微信个人信息成功回调,登录
     *
     */
    public void getUserInforCallback(int reqID /*ResponseState state, PlatformType type, Hashtable data*/)
    {
        //TipsManagerScript.getInstance ().setTips ("获取个人信息成功");
        LoginVo loginvo = new LoginVo();

        try
        {
            loginvo.openId   = "100100104";
            loginvo.nickName = "测试";
            loginvo.headIcon = "-";
            loginvo.unionId  = "100100104";
            loginvo.province = "浙江省";
            loginvo.city     = "杭州市";
            string sex = "1";
            loginvo.sex = int.Parse(sex);
            loginvo.IP  = GlobalDataScript.getInstance().getIpAddress();
            String msg = JsonMapper.ToJson(loginvo);

            CustomSocket.getInstance().sendMsg(new LoginRequest(msg));

            GlobalDataScript.loginVo                          = loginvo;
            GlobalDataScript.loginResponseData                = new AvatarVO();
            GlobalDataScript.loginResponseData.account        = new Account();
            GlobalDataScript.loginResponseData.account.city   = loginvo.city;
            GlobalDataScript.loginResponseData.account.openId = loginvo.openId;
            Debug.Log(" loginvo.nickName:" + loginvo.nickName);
            GlobalDataScript.loginResponseData.account.nickName = loginvo.nickName;
            GlobalDataScript.loginResponseData.account.headIcon = loginvo.headIcon;
            GlobalDataScript.loginResponseData.account.unionId  = loginvo.city;
            GlobalDataScript.loginResponseData.account.sex      = loginvo.sex;
            GlobalDataScript.loginResponseData.IP = loginvo.IP;
        }
        catch (Exception e)
        {
            Debug.Log("微信接口有变动!" + e.Message);
            TipsManagerScript.getInstance().setTips("请先打开你的微信客户端");
            return;
        }
    }
Example #15
0
    void Start()
    {
        //

                #if UNITY_IPHONE && !UNITY_EDITOR
        if (GlobalDataScript.getInstance().wechatOperate.shareSdk.IsClientValid(PlatformType.WechatPlatform))
        {
            youkeBtn.SetActive(false);
            loginBtn.SetActive(true);
        }
        else
        {
            youkeBtn.SetActive(true);
            loginBtn.SetActive(false);
        }
                #else
        youkeBtn.SetActive(false);
        loginBtn.SetActive(true);
                #endif


        //shareSdk.showUserHandler = getUserInforCallback;//注册获取用户信息回调
        CustomSocket.hasStartTimer = false;
        SocketEventHandle.getInstance().LoginCallBack    += LoginCallBack;
        SocketEventHandle.getInstance().RoomBackResponse += RoomBackResponse;


        GlobalDataScript.isonLoginPage = true;
        versionText.text = "版本号:" + Application.version;
        //WxPayImpl test = new WxPayImpl(gameObject);
        //test.callTest ("dddddddddddddddddddddddddddd");
        StartCoroutine(ConnectTime1(3f, 1));

        //每隔0.1秒執行一次定時器
        InvokeRepeating("isConnected", 0.1f, 0.1f);

        GlobalDataScript.headTime = GlobalDataScript.GetTimeStamp();
    }
Example #16
0
    public void doLogin()
    {
        if (loginText.isActiveAndEnabled)
        {
            CustomSocket.getInstance().sendMsg(new LoginRequest(loginText.text, loginText.text));
            return;
        }

        if (PlayerPrefs.HasKey("loginInfo"))
        {
            string msg = PlayerPrefs.GetString("loginInfo");
            CustomSocket.getInstance().sendMsg(new LoginRequest(msg));
        }
        else
        {
                        #if UNITY_EDITOR
            //用于测试 不用微信登录
            CustomSocket.getInstance().sendMsg(new LoginRequest(null));
                        #else
            GlobalDataScript.getInstance().wechatOperate.login();
                        #endif
        }
    }
Example #17
0
 public void doLogin()
 {
     StartCoroutine(ConnectTime(10, 0));
             #if UNITY_EDITOR
     //用于测试 不用微信登录
     //CustomSocket.getInstance().sendMsg(new LoginRequest(null));
             #else
     //GlobalDataScript.getInstance ().wechatOperate.login ();
             #endif
     if (testloginID.text == "null")
     {
         CustomSocket.getInstance().sendMsg(new LoginRequest(null));
     }
     else if (!string.IsNullOrEmpty(testloginID.text))
     {
         int num = int.Parse(testloginID.text);
         CustomSocket.getInstance().sendMsg(new LoginRequest(num));
     }
     else
     {
         GlobalDataScript.getInstance().wechatOperate.login();
     }
 }
Example #18
0
        public LoginRequest(int id)
        {
            string data = null;

            MyDebug.Log("----------------4------------------");
            headCode = APIS.LOGIN_REQUEST;

            LoginVo loginvo = new LoginVo();
            Random  ran     = new Random();
            string  str     = ran.Next(100, 1000) + "for" + ran.Next(2000, 5000);

            loginvo.openId = id.ToString();
            MyDebug.Log("----------------5------------------");

            loginvo.nickName = "test" + id;
            loginvo.headIcon = "imgico221";
            loginvo.unionid  = "12732" + id;
            loginvo.province = "21s" + id;
            loginvo.city     = "afafsdf";
            loginvo.sex      = 1;
            loginvo.IP       = GlobalDataScript.getInstance().getIpAddress();
            data             = JsonMapper.ToJson(loginvo);

            GlobalDataScript.loginVo                            = loginvo;
            GlobalDataScript.loginResponseData                  = new AvatarVO();
            GlobalDataScript.loginResponseData.account          = new Account();
            GlobalDataScript.loginResponseData.account.city     = loginvo.city;
            GlobalDataScript.loginResponseData.account.openid   = loginvo.openId;
            GlobalDataScript.loginResponseData.account.nickname = loginvo.nickName;
            GlobalDataScript.loginResponseData.account.headicon = loginvo.headIcon;
            GlobalDataScript.loginResponseData.account.unionid  = loginvo.unionid;
            GlobalDataScript.loginResponseData.account.sex      = loginvo.sex;
            GlobalDataScript.loginResponseData.IP               = loginvo.IP;

            MyDebug.Log("----------------6------------------" + messageContent);
            messageContent = data;
        }
Example #19
0
    public void LoginCallBack(ClientResponse response)
    {
        if (watingPanel != null)
        {
            watingPanel.SetActive(false);
        }

        SoundCtrl.getInstance().stopBGM();
        SoundCtrl.getInstance().playBGM();
        if (response.status == 1)
        {
            if (GlobalDataScript.homePanel != null)
            {
                GlobalDataScript.homePanel.GetComponent <HomePanelScript>().removeListener();
                Destroy(GlobalDataScript.homePanel);
            }


            if (GlobalDataScript.gamePlayPanel != null)
            {
                GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript>().exitOrDissoliveRoom();
            }

            GlobalDataScript.loginResponseData = JsonMapper.ToObject <AvatarVO>(response.message);
            ChatSocket.getInstance().sendMsg(new LoginChatRequest(GlobalDataScript.loginResponseData.account.uuid));
            panelCreateDialog = Instantiate(Resources.Load("Prefab/Panel_Home")) as GameObject;
            panelCreateDialog.transform.parent     = GlobalDataScript.getInstance().canvsTransfrom;
            panelCreateDialog.transform.localScale = Vector3.one;
            panelCreateDialog.GetComponent <RectTransform>().offsetMax = new Vector2(0f, 0f);
            panelCreateDialog.GetComponent <RectTransform>().offsetMin = new Vector2(0f, 0f);
            GlobalDataScript.homePanel = panelCreateDialog;
            removeListener();
            Destroy(this);
            Destroy(gameObject);
        }
    }
    // 系统聊天消息声音 如:快点出 我等到花儿都谢了
    public void playMessageBoxSound(int codeIndex)
    {
        // 绑定事件
        PlayerItemScript.instant.stopBGMDelege = StopBGM;


        if (GlobalDataScript.getInstant().soundToggle)
        {
            Debug.Log(codeIndex);
            // 声音资源所在的目录
            string path = "Sounds/other/" + codeIndex.ToString();

            AudioClip temp = (AudioClip)soudHash [path];
            if (temp == null)
            {
                temp = GameObject.Instantiate(Resources.Load(path)) as AudioClip;
                soudHash.Add(path, temp);
            }

            audioSouce.clip = temp;

            audioSouce.Play();
        }
    }
Example #21
0
    public void showChatMessage(int index)
    {
        SoundCtrl.getInstance().playMessageBoxSound(index);

        // 执行委托事件 停止bgm
        stopBGMDelege();


        showTime = 2.5f;
        index    = index - 1001;

        // 给消息内容给聊天面板text
        chatMessage.text = GlobalDataScript.getInstant().messageBoxcontent[index];



        // 这里把聊天气泡显示出来
        chatPaoPao.SetActive(true);
        // 2.5s后聊天气泡消失s
        Invoke("hideChatPaoPao", showTime);

        // 2s后 背景音乐重新开始
        Invoke("bgmBegin", 3.5f);
    }
Example #22
0
    public void setGender()
    {
        GlobalDataScript gData = GameObject.Find("Canvas").GetComponent <GlobalDataScript>();

        gData.setCharacter(this.GetComponentInChildren <TextMeshProUGUI>().text);
    }
Example #23
0
 public void doShare()
 {
     GlobalDataScript.getInstance().wechatOperate.shareAchievementToWeChat(PlatformType.WeChat);
     SoundCtrl.getInstance().playSoundByActionButton(1);
 }
Example #24
0
    // Use this for initialization
    void Start()
    {
        // dodgeDistanceFloat = 3;
        enemyD = FindObjectOfType <EnemyDialogue>();

        dummyGameObject = GameObject.Find("Dummy Object");
        //rayCastHitDodge.size;
        rayCastDodgeArray = new int[100];

        playerObject    = GameObject.Find("Player");
        playerTransform = playerObject.transform;

        layerMaskPlayerInt = 1 << 9;
        layerMaskPlayer    = ~layerMaskPlayerInt;
        layerMaskBoundsInt = 1 << 10;
        layerMaskBounds    = ~layerMaskBoundsInt;
        layerMaskEnemyInt  = 1 << 11;
        layerMaskEnemy     = ~layerMaskEnemyInt;

        rayDodgeDistance = 4;

        playerStats = FindObjectOfType <PlayerStats>();

        playerShield = FindObjectOfType <ShieldBlock>();

        sfxMan = FindObjectOfType <SFXManager>();

        theDM = FindObjectOfType <DialogueManager>();

        staminaMan = GetComponent <PlayerStaminaManager>();

        enemy = FindObjectOfType <EnemyTestScript>();

        playerHealth = FindObjectOfType <PlayerHealthManager>();

        hurtPlayer = FindObjectOfType <HurtPlayerUpdated>();

        hurtEnemy = FindObjectOfType <HurtEnemy>();

        globalData = FindObjectOfType <GlobalDataScript>();

        playerBoundBoxObject = GameObject.Find("Bounds");

        enemyTargetObject = this.gameObject;
        dmObject          = GameObject.Find("Dialogue Manager");
        theDM             = dmObject.GetComponent <DialogueManager>();

        terrainManager = FindObjectOfType <TerrainManager>();

        damagePossible = false;
        attackPossible = true;
        dashPossible   = true;

        anim        = GetComponent <Animator>();
        myRigidbody = GetComponent <Rigidbody2D>();

        if (!playerExists)
        {
            playerExists = true;
            //DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            //Destroy(gameObject);
        }

        canMove = true;

        lastMove = new Vector2(globalData.globalPlayerLastMoveX, globalData.globalPlayerLastMoveY);

        currentEnemyExists = true;

        if (boundBox == null)
        {
            //boundBox = FindObjectOfType<BoundsScript>().GetComponent<BoxCollider2D>();
            boundBox  = playerBoundBoxObject.GetComponent <BoxCollider2D>();
            minBounds = boundBox.bounds.min;
            maxBounds = boundBox.bounds.max;
        }

        minBounds = boundBox.bounds.min;
        maxBounds = boundBox.bounds.max;

        deathStrike = false;

        playerOldHealth = playerNewHealth;

        strikeBlock = false;

        strikeBlockCounter = 1f;

        noDamageIsTaken = true;

        preAttack   = false;
        recovAttack = false;

        preAttackCounter   = 0.2f;
        recovAttackCounter = 0.3f;
        attackTimeCounter  = 10;

        attackingCounterNew = 0.06f;

        specialMove = false;

        wasMoving      = false;
        wasSprint      = false;
        sprintTimer    = 0.2f;
        sprintPossible = false;

        // if (globalData.globalPlayerLockOn == 1)
        // {
        //     lockOn = false;
        // }
        // else
        // {
        //     lockOn = false;
        // }

        lockOn          = false;
        newListBool     = true;
        switchEnemyBool = true;

        equipmentBuffManagerScript = FindObjectOfType <EquipmentBuffManager>();

        lockOnImage = GameObject.Find("lockOnImage");
        lockOnImage.SetActive(false);
    }
Example #25
0
 public void doShare()
 {
     SoundCtrl.getInstance().playSoundUI();
     GlobalDataScript.getInstance().wechatOperate.shareAchievementToWeChat(PlatformType.WeChat);
 }
Example #26
0
 public void shareToWeChat()
 {
     GlobalDataScript.getInstance().wechatOperate.shareAchievementToWeChat(PlatformType.WeChatMoments);
 }
Example #27
0
    /**
     * 获取微信个人信息成功回调,登录
     *
     */
    public void authResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable data)
    {
        //TipsManagerScript.getInstance ().setTips ("获取个人信息成功");
        debug_Text.text = ("成功回调微信信息,开始登录");
        //TipsManagerScript.getInstance ().setTipsBig (data.toJson());
                #if UNITY_IOS
        shareSdk.GetUserInfo(PlatformType.WeChat);
        return;
                #else
        data = shareSdk.GetAuthInfo(PlatformType.WeChat);
                #endif
        if (data != null)
        {
            LoginVo loginvo = new LoginVo();
            try {
                MyDebug.Log(data.toJson());
                //TipsManagerScript.getInstance ().setTipsBig (data.toJson());

                loginvo.openId   = (string)data ["openid"];
                loginvo.nickName = (string)data ["nickname"];
                loginvo.headIcon = (string)data ["icon"];
                loginvo.unionid  = (string)data ["unionid"];
                loginvo.province = (string)data ["province"];
                loginvo.city     = (string)data ["city"];
                string sex = data ["gender"].ToString();
                loginvo.sex = int.Parse(sex);
                loginvo.IP  = GlobalDataScript.getInstance().getIpAddress();
                String msg = JsonMapper.ToJson(loginvo);

                PlayerPrefs.SetString("loginInfo", msg);

                CustomSocket.getInstance().sendMsg(new LoginRequest(msg));

                /*
                 * GlobalDataScript.loginVo = loginvo;
                 * GlobalDataScript.loginResponseData = new AvatarVO ();
                 * GlobalDataScript.loginResponseData.account = new Account ();
                 * GlobalDataScript.loginResponseData.account.city = loginvo.city;
                 * GlobalDataScript.loginResponseData.account.openid = loginvo.openId;
                 * MyDebug.Log(" loginvo.nickName:"+loginvo.nickName);
                 * GlobalDataScript.loginResponseData.account.nickname = loginvo.nickName;
                 * GlobalDataScript.loginResponseData.account.headicon = loginvo.headIcon;
                 * GlobalDataScript.loginResponseData.account.unionid = loginvo.city;
                 * GlobalDataScript.loginResponseData.account.sex = loginvo.sex;
                 * GlobalDataScript.loginResponseData.IP = loginvo.IP;
                 *
                 * //加载头像
                 * if(GlobalDataScript.loginVo.sex == 2){
                 *      GlobalDataScript.getInstance().headSprite = Resources.Load ("xianlai/public_ui/head_img_female", typeof(Sprite)) as Sprite;
                 * }else {
                 *      GlobalDataScript.getInstance().headSprite = Resources.Load ("xianlai/public_ui/head_img_male", typeof(Sprite)) as Sprite;
                 * }
                 */
            } catch (Exception e) {
                MyDebug.Log("微信接口有变动!" + e.Message);
                TipsManagerScript.getInstance().setTips("微信接口有变动!" + e.Message);
                return;
            }
        }
        else
        {
            TipsManagerScript.getInstance().setTips("微信登录失败");
        }
    }
Example #28
0
        private void dispatchHandle(ClientResponse response)
        {
            switch (response.headCode)
            {
            case APIS.CLOSE_RESPONSE:
                TipsManagerScript.getInstance().setTips("服务器关闭了");
                CustomSocket.getInstance().closeSocket();
                break;

            case APIS.LOGIN_RESPONSE:
                if (LoginCallBack != null)
                {
                    LoginCallBack(response);
                }
                break;

            case APIS.CREATEROOM_RESPONSE:
                if (CreateRoomCallBack != null)
                {
                    CreateRoomCallBack(response);
                }
                break;

            case APIS.JOIN_ROOM_RESPONSE:
                if (JoinRoomCallBack != null)
                {
                    JoinRoomCallBack(response);
                }
                break;

            case APIS.STARTGAME_RESPONSE_NOTICE:
                if (StartGameNotice != null)
                {
                    StartGameNotice(response);
                }
                break;

            case APIS.PICKCARD_RESPONSE:
                if (pickCardCallBack != null)
                {
                    pickCardCallBack(response);
                }
                break;

            case APIS.OTHER_PICKCARD_RESPONSE_NOTICE:
                if (otherPickCardCallBack != null)
                {
                    otherPickCardCallBack(response);
                }
                break;

            case APIS.CHUPAI_RESPONSE:
                if (putOutCardCallBack != null)
                {
                    putOutCardCallBack(response);
                }
                break;

            case APIS.CHUPAI_PDK_RESPONSE:
                if (PDK_putOutCardCallBack != null)
                {
                    PDK_putOutCardCallBack(response);
                }
                break;

            case APIS.CHIBUQI_PDK_RESPONSE:
                if (PDK_ChiBuQiCallBack != null)
                {
                    PDK_ChiBuQiCallBack(response);
                }
                break;

            case APIS.JOIN_ROOM_NOICE:
                if (otherUserJointRoomCallBack != null)
                {
                    otherUserJointRoomCallBack(response);
                }
                break;

            case APIS.JOIN_ROOM_IP_RESPONSE:
                if (JoinRoomIPCallBack != null)
                {
                    JoinRoomIPCallBack(response);
                }
                break;

            case APIS.PENGPAI_RESPONSE:
                if (PengCardCallBack != null)
                {
                    PengCardCallBack(response);
                }
                break;

            case APIS.CHI_RESPONSE:
                if (ChiCardCallBack != null)
                {
                    ChiCardCallBack(response);
                }
                break;

            case APIS.GANGPAI_RESPONSE:
                if (GangCardCallBack != null)
                {
                    GangCardCallBack(response);
                }
                break;

            case APIS.OTHER_GANGPAI_NOICE:
                if (gangCardNotice != null)
                {
                    gangCardNotice(response);
                }
                break;

            case APIS.RETURN_INFO_RESPONSE:
                if (btnActionShow != null)
                {
                    btnActionShow(response);
                }
                break;

            case APIS.HUPAI_RESPONSE:
                if (HupaiCallBack != null)
                {
                    HupaiCallBack(response);
                }
                break;

            case APIS.HUPAIBACKDZPK_RESPONSE:
                if (HupaiBackDzpkCallBack != null)
                {
                    HupaiBackDzpkCallBack(response);
                }
                break;

            case APIS.HUPAIALL_RESPONSE:
                if (FinalGameOverCallBack != null)
                {
                    FinalGameOverCallBack(response);
                }
                break;

            case APIS.OUT_ROOM_RESPONSE:
                if (outRoomCallback != null)
                {
                    outRoomCallback(response);
                }
                break;

            case APIS.headRESPONSE:
                break;

            case APIS.DISSOLIVE_ROOM_RESPONSE:
                if (dissoliveRoomResponse != null)
                {
                    dissoliveRoomResponse(response);
                }
                break;

            case APIS.PrepareGame_MSG_RESPONSE:
                if (gameReadyNotice != null)
                {
                    gameReadyNotice(response);
                }
                break;

            case APIS.MicInput_Response:
                if (micInputNotice != null)
                {
                    micInputNotice(response);
                }
                break;

            case APIS.MessageBox_Notice:
                if (messageBoxNotice != null)
                {
                    messageBoxNotice(response);
                }
                break;

            case APIS.ERROR_RESPONSE:
                if (serviceErrorNotice != null)
                {
                    serviceErrorNotice(response);
                }
                break;

            case APIS.BACK_LOGIN_RESPONSE:
                if (RoomBackResponse != null)
                {
                    RoomBackResponse(response);
                }

                break;

            case APIS.CARD_CHANGE:
                if (cardChangeNotice != null)
                {
                    cardChangeNotice(response);
                }
                break;

            case APIS.OFFLINE_NOTICE:
                if (offlineNotice != null)
                {
                    offlineNotice(response);
                }
                break;

            case APIS.RETURN_ONLINE_RESPONSE:

                if (returnGameResponse != null)
                {
                    returnGameResponse(response);
                }
                break;

            case APIS.PRIZE_RESPONSE:
                if (giftResponse != null)
                {
                    giftResponse(response);
                }
                break;

            case APIS.Game_FollowBander_Notice:
                if (gameFollowBanderNotice != null)
                {
                    gameFollowBanderNotice(response);
                }
                break;


            case APIS.ONLINE_NOTICE:
                if (onlineNotice != null)
                {
                    onlineNotice(response);
                }
                break;

            case APIS.GAME_BROADCAST:
                if (gameBroadcastNotice != null)
                {
                    gameBroadcastNotice(response);
                }
                break;

            case APIS.GAME_CONFIG:
                if (gameConfigNotice != null)
                {
                    gameConfigNotice(response);
                }
                break;

            case APIS.CONTACT_INFO_RESPONSE:
                if (contactInfoResponse != null)
                {
                    contactInfoResponse(response);
                }
                break;

            case APIS.HOST_UPDATEDRAW_RESPONSE:
                if (hostUpdateDrawResponse != null)
                {
                    hostUpdateDrawResponse(response);
                }
                break;

            case APIS.ZHANJI_REPORTER_REPONSE:
                if (zhanjiResponse != null)
                {
                    zhanjiResponse(response);
                }
                break;

            case APIS.ZHANJI_DETAIL_REPORTER_REPONSE:
                if (zhanjiDetailResponse != null)
                {
                    zhanjiDetailResponse(response);
                }
                break;

            case APIS.GAME_BACK_PLAY_RESPONSE:
                if (gameBackPlayResponse != null)
                {
                    gameBackPlayResponse(response);
                }
                break;

            case APIS.TIP_MESSAGE:
                TipsManagerScript.getInstance().setTips(response.message);
                break;

            case APIS.OTHER_TELE_LOGIN:
                if (otherTeleLogin != null)
                {
                    otherTeleLogin(response);
                }
                break;

            case APIS.QIANG_DN_RESPONSE:
                if (DN_qiangResponse != null)
                {
                    DN_qiangResponse(response);
                }
                break;

            case APIS.ZHUANG_DN_RESPONSE:
                if (DN_zhuangResponse != null)
                {
                    DN_zhuangResponse(response);
                }
                break;

            case APIS.ZHU_DN_RESPONSE:
                if (DN_xiaZhuResponse != null)
                {
                    DN_xiaZhuResponse(response);
                }
                break;

            case APIS.NIU_DN_RESPONSE:
                if (DN_niuResponse != null)
                {
                    DN_niuResponse(response);
                }
                break;

            case APIS.NIUNOTICE_DN_RESPONSE:
                if (DN_niuResponse != null)
                {
                    DN_niuNoticeResponse(response);
                }
                break;

            case APIS.NIUSETTLE_DN_RESPONSE:
                if (DN_niuSettleResponse != null)
                {
                    DN_niuSettleResponse(response);
                }
                break;

            case APIS.GENZHU_DZPK_RESPONSE:
                if (DZPK_genZhuResponse != null)
                {
                    DZPK_genZhuResponse(response);
                }
                break;

            case APIS.JIAZHU_DZPK_RESPONSE:
                if (DZPK_jiaZhuResponse != null)
                {
                    DZPK_jiaZhuResponse(response);
                }
                break;

            case APIS.QIPAI_DZPK_RESPONSE:
                if (DZPK_qiPaiResponse != null)
                {
                    DZPK_qiPaiResponse(response);
                }
                break;

            case APIS.RANGPAI_DZPK_RESPONSE:
                if (DZPK_rangPaiResponse != null)
                {
                    DZPK_rangPaiResponse(response);
                }
                break;

            case APIS.PUTOFF_DZPK_RESPONSE:
                if (DZPK_putOffResponse != null)
                {
                    DZPK_putOffResponse(response);
                }
                break;

            case APIS.FAPAI_DZPK_RESPONSE:
                if (DZPK_faPaiResponse != null)
                {
                    DZPK_faPaiResponse(response);
                }
                break;

            case APIS.ShangHuo_MSG_RESPONSE:
                if (shanghuoResponse != null)
                {
                    shanghuoResponse(response);
                }
                break;

            case APIS.CHEAT_Response:
                if (cheatCallBack != null)
                {
                    cheatCallBack(response);
                }
                break;
            }


            GlobalDataScript.headTime = GlobalDataScript.GetTimeStamp();
        }
Example #29
0
 public void doLogin()
 {
     GlobalDataScript.getInstance().wechatOperate.login();
 }
Example #30
0
    public void onJoinRoomCallBack(ClientResponse response)
    {
        watingPanel.gameObject.SetActive(false);
        MyDebug.Log(response);
        if (response.status == 1)
        {
            GlobalDataScript.roomJoinResponseData = JsonMapper.ToObject <RoomCreateVo>(response.message);

            GlobalDataScript.roomVo.addWordCard     = GlobalDataScript.roomJoinResponseData.addWordCard;
            GlobalDataScript.roomVo.hong            = GlobalDataScript.roomJoinResponseData.hong;
            GlobalDataScript.roomVo.ma              = GlobalDataScript.roomJoinResponseData.ma;
            GlobalDataScript.roomVo.name            = GlobalDataScript.roomJoinResponseData.name;
            GlobalDataScript.roomVo.roomId          = GlobalDataScript.roomJoinResponseData.roomId;
            GlobalDataScript.roomVo.roomType        = GlobalDataScript.roomJoinResponseData.roomType;
            GlobalDataScript.roomVo.roundNumber     = GlobalDataScript.roomJoinResponseData.roundNumber;
            GlobalDataScript.roomVo.sevenDouble     = GlobalDataScript.roomJoinResponseData.sevenDouble;
            GlobalDataScript.roomVo.xiaYu           = GlobalDataScript.roomJoinResponseData.xiaYu;
            GlobalDataScript.roomVo.ziMo            = GlobalDataScript.roomJoinResponseData.ziMo;
            GlobalDataScript.roomVo.gui             = GlobalDataScript.roomJoinResponseData.gui;
            GlobalDataScript.roomVo.gangHu          = GlobalDataScript.roomJoinResponseData.gangHu;
            GlobalDataScript.roomVo.gangHuQuanBao   = GlobalDataScript.roomJoinResponseData.gangHuQuanBao;
            GlobalDataScript.roomVo.wuGuiX2         = GlobalDataScript.roomJoinResponseData.wuGuiX2;
            GlobalDataScript.roomVo.guiPai          = GlobalDataScript.roomJoinResponseData.guiPai;
            GlobalDataScript.roomVo.shangxiaFanType = GlobalDataScript.roomJoinResponseData.shangxiaFanType;
            GlobalDataScript.roomVo.diFen           = GlobalDataScript.roomJoinResponseData.diFen;
            GlobalDataScript.roomVo.tongZhuang      = GlobalDataScript.roomJoinResponseData.tongZhuang;
            GlobalDataScript.roomVo.pingHu          = GlobalDataScript.roomJoinResponseData.pingHu;
            GlobalDataScript.roomVo.keDianPao       = GlobalDataScript.roomJoinResponseData.keDianPao;
            GlobalDataScript.roomVo.lunZhuang       = GlobalDataScript.roomJoinResponseData.lunZhuang;
            GlobalDataScript.roomVo.gameType        = GlobalDataScript.roomJoinResponseData.gameType;
            GlobalDataScript.roomVo.zhang16         = GlobalDataScript.roomJoinResponseData.zhang16;
            GlobalDataScript.roomVo.showPai         = GlobalDataScript.roomJoinResponseData.showPai;
            GlobalDataScript.roomVo.xian3           = GlobalDataScript.roomJoinResponseData.xian3;
            GlobalDataScript.roomVo.qiang           = GlobalDataScript.roomJoinResponseData.qiang;
            GlobalDataScript.roomVo.ming            = GlobalDataScript.roomJoinResponseData.ming;
            GlobalDataScript.roomVo.mengs           = GlobalDataScript.roomJoinResponseData.mengs;
            GlobalDataScript.roomVo.AA              = GlobalDataScript.roomJoinResponseData.AA;

            GlobalDataScript.surplusTimes             = GlobalDataScript.roomJoinResponseData.roundNumber;
            GlobalDataScript.loginResponseData.roomId = GlobalDataScript.roomJoinResponseData.roomId;

            GlobalDataScript.reEnterRoomData = null;

            GlobalDataScript.loadTime = GlobalDataScript.GetTimeStamp();

            if (GlobalDataScript.roomVo.gameType == 0)            //(int)GameType.GameType_PK_PDK
            {
                GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePlay");
            }
            else if (GlobalDataScript.roomVo.gameType == 1)            //(int)GameType.GameType_PK_PDK
            {
                GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePDK");
            }
            else if (GlobalDataScript.roomVo.gameType == 3)            //(int)GameType.GameType_PK_DN
            {
                GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GameDN");
            }
            //GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab(GlobalDataScript.playObject);
            //SocketEventHandle.getInstance().gameReadyNotice += GlobalDataScript.gamePlayPanel.GetComponent<MyMahjongScript>().gameReadyNotice;
            //GlobalDataScript.gamePlayPanel.GetComponent<MyMahjongScript>().joinToRoom(GlobalDataScript.roomJoinResponseData.playerList);

            connectRetruen = true;
            closeDialog();
        }
        else
        {
            //clear();
            //TipsManagerScript.getInstance();
            //watingPanel.gameObject.SetActive(true);
            //watingPanel.gameObject.transform.gameObject.SetActive(true);
            //watingPanel.gameObject.transform.FindChild("tip3/Text").GetComponent<Text>().text = response.message;


            TipsManagerScript.getInstance().setTips(response.message);
            closeDialog();
            GlobalDataScript.homePanel.GetComponent <HomePanelScript>().openEnterRoomDialog();
        }
    }