Exemple #1
0
        void OnGUI()
        {
            GUI.skin = demoSkin;

            float scale = 1.0f;

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                scale = Screen.width / 320;
            }

            float btnWidth  = 200 * scale;
            float btnHeight = 30 * scale;
            float btnTop    = 50 * scale;

            GUI.skin.button.fontSize     = Convert.ToInt32(14 * scale);
            GUI.skin.label.fontSize      = Convert.ToInt32(14 * scale);
            GUI.skin.label.alignment     = TextAnchor.MiddleCenter;
            GUI.skin.textField.fontSize  = Convert.ToInt32(14 * scale);
            GUI.skin.textField.alignment = TextAnchor.MiddleCenter;

            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop + 5, 100, btnHeight), "手机号");

            phone = GUI.TextField(new Rect((Screen.width - btnWidth) / 2 + 100, btnTop, btnWidth - 100, btnHeight), phone);

            btnTop += btnHeight + 10 * scale;

            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop + 5, 100, btnHeight), "区号");

            zone = GUI.TextField(new Rect((Screen.width - btnWidth) / 2 + 100, btnTop, btnWidth - 100, btnHeight), zone);

            btnTop += btnHeight + 10 * scale;

            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop + 5, 100, btnHeight), "验证码");

            code = GUI.TextField(new Rect((Screen.width - btnWidth) / 2 + 100, btnTop, btnWidth - 100, btnHeight), code);

            btnTop += btnHeight + 10 * scale;

            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCodeSMS"))
            {
                smssdk.getCode(CodeType.TextCode, phone, zone);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "CommitCode"))
            {
                smssdk.commitCode(phone, zone, code);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCodeVoice"))
            {
                smssdk.getCode(CodeType.VoiceCode, phone, zone);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCountryCode"))
            {
                smssdk.getSupportedCountryCode();
            }


            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetFriends"))
            {
                smssdk.getFriends();
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SubmitUserInfo"))
            {
                userInfo.avatar      = "www.mob.com";
                userInfo.phoneNumber = phone;
                userInfo.zone        = zone;
                userInfo.nickName    = "David";
                userInfo.uid         = "1234567890";
                smssdk.submitUserInfo(userInfo);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetVersionNumber"))
            {
                smssdk.getVersion();
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "EnableWarn"))
            {
                smssdk.enableWarn(true);
            }

            //展示register UI界面
            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "showRegisterUIView"))
            {
                smssdk.showRegisterPage(CodeType.TextCode);
            }

            //展示contractFriends UI界面
            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "showContractsUIView"))
            {
                smssdk.showContactsPage();
            }
            //展示回调结果
            btnTop += btnHeight + 10 * scale;
            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), result);
        }
Exemple #2
0
        void OnGUI()
        {
            GUI.skin = demoSkin;

            float scale = 1.0f;

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                scale = Screen.width / 320;
            }


            float btnWidth  = 200 * scale;
            float btnHeight = 35 * scale;
            float btnTop    = 20 * scale;

            GUI.skin.button.fontSize = Convert.ToInt32(16 * scale);

            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCodeSMS"))
            {
                smssdk.getCode(CodeType.TextCode, phone, "86");
            }


            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCodeVoice"))
            {
                smssdk.getCode(CodeType.VoiceCode, phone, "86");
            }

            //添加textField  输入验证码
            btnTop += btnHeight + 20 * scale;
            code    = GUI.TextField(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), code);

            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "CommitCode"))
            {
                smssdk.commitCode(phone, "86", code);
            }


            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCountryCode"))
            {
                smssdk.getSupportedCountryCode();
            }


            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetFriends"))
            {
                smssdk.getFriends();
            }

            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SubmitUserInfo"))
            {
                userInfo.avatar      = "www.mob.com";
                userInfo.phoneNumber = phone;
                userInfo.zone        = zone;
                userInfo.nickName    = "David";
                userInfo.uid         = "18616261983";
                smssdk.submitUserInfo(userInfo);
            }

            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetVersionNumber"))
            {
                smssdk.getVersion();
            }

            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "EnableWarn"))
            {
                smssdk.enableWarn(true);
            }

            //展示register UI界面
            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "showRegisterUIView"))
            {
                smssdk.showRegisterPage(CodeType.TextCode);
            }

            //展示contractFriends UI界面
            btnTop += btnHeight + 20 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "showContractsUIView"))
            {
                smssdk.showContactsPage();
            }
            //展示回调结果
            btnTop += btnHeight + 20 * scale;
            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), result);
        }
Exemple #3
0
        void OnGUI()
        {
            GUI.skin = demoSkin;

            float scale = 1.0f;

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                scale = Screen.width / 320;
            }
            else if (Application.platform == RuntimePlatform.Android)
            {
                if (Screen.orientation == ScreenOrientation.Portrait)
                {
                    scale = Screen.width / 320;
                }
                else
                {
                    scale = Screen.height / 320;
                }
            }

            float btnWidth  = 200 * scale;
            float btnHeight = 30 * scale;
            float btnTop    = 50 * scale;

            GUI.skin.button.fontSize     = Convert.ToInt32(14 * scale);
            GUI.skin.label.fontSize      = Convert.ToInt32(14 * scale);
            GUI.skin.label.alignment     = TextAnchor.MiddleCenter;
            GUI.skin.textField.fontSize  = Convert.ToInt32(14 * scale);
            GUI.skin.textField.alignment = TextAnchor.MiddleCenter;

            float labelWidth = 60 * scale;

            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop + 5, labelWidth, btnHeight), "手机号");

            phone = GUI.TextField(new Rect((Screen.width - btnWidth) / 2 + labelWidth, btnTop, btnWidth - labelWidth, btnHeight), phone);

            btnTop += btnHeight + 10 * scale;

            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop + 5, labelWidth, btnHeight), "区号");

            zone = GUI.TextField(new Rect((Screen.width - btnWidth) / 2 + labelWidth, btnTop, btnWidth - labelWidth, btnHeight), zone);

            btnTop += btnHeight + 10 * scale;

            GUI.Label(new Rect((Screen.width - btnWidth) / 2, btnTop + 5, labelWidth, btnHeight), "验证码");

            code = GUI.TextField(new Rect((Screen.width - btnWidth) / 2 + labelWidth, btnTop, btnWidth - labelWidth, btnHeight), code);

            btnTop += btnHeight + 10 * scale;

            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCodeSMS"))
            {
                smssdk.getCode(CodeType.TextCode, phone, zone, tempCode);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "CommitCode"))
            {
                smssdk.commitCode(phone, zone, code);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCodeVoice"))
            {
                smssdk.getCode(CodeType.VoiceCode, phone, zone, tempCode);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetCountryCode"))
            {
                smssdk.getSupportedCountryCode();
            }


            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetFriends"))
            {
                smssdk.getFriends();
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "SubmitUserInfo"))
            {
                userInfo.avatar      = "www.mob.com";
                userInfo.phoneNumber = phone;
                userInfo.zone        = zone;
                userInfo.nickName    = "David";
                userInfo.uid         = "1234567890";
                smssdk.submitUserInfo(userInfo);
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "GetVersionNumber"))
            {
                smssdk.getVersion();
            }

            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "EnableWarn"))
            {
                smssdk.enableWarn(true);
            }

            //展示register UI界面
            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "showRegisterUIView"))
            {
                // 模板号可以为空
                smssdk.showRegisterPage(CodeType.TextCode, tempCode);
            }

            //展示contractFriends UI界面
            btnTop += btnHeight + 10 * scale;
            if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "showContractsUIView"))
            {
                smssdk.showContactsPage();
            }
            //展示回调结果
            btnTop += btnHeight + 10 * scale;
            GUIStyle style = new GUIStyle();

            style.normal.textColor = new Color(1, 0, 0);          //字体颜色
            // style.fontSize = 30;
            style.fontSize = (int)(20 * scale);                   //字体大小
            GUI.Label(new Rect(20, btnTop, Screen.width - 20 - 20, Screen.height - btnTop), result, style);
        }