예제 #1
0
    private void OnEnable()
    {
#if UNITY_ANDROID
        var builder = new StringBuilder();
        // Device info
        builder.AppendLine("ANDROID_ID : " + AndroidDeviceInfo.GetAndroidId());
        builder.AppendLine("APP_VERSION : " + Application.version.ToString());

        builder.AppendLine("----------- Build class------------");
        builder.AppendLine("DEVICE : " + AndroidDeviceInfo.DEVICE);
        builder.AppendLine("MODEL : " + AndroidDeviceInfo.MODEL);
        builder.AppendLine("SERIAL : " + AndroidDeviceInfo.SERIAL);
        builder.AppendLine("PRODUCT : " + AndroidDeviceInfo.PRODUCT);
        builder.AppendLine("MANUFACTURER : " + AndroidDeviceInfo.MANUFACTURER);
        builder.AppendLine("RESOLUTION : " + Screen.currentResolution.ToString());
        builder.AppendLine("SDK : " + AndroidDeviceInfo.SDK_INT);

        verText.text       = builder.ToString();
        textVerSimple.text = "版本号: " + Application.version.ToString() + " 设备号: " + AndroidDeviceInfo.GetAndroidId();
        if (Application.internetReachability != NetworkReachability.NotReachable && Application.platform != RuntimePlatform.WindowsEditor)
        {
            CheckNeedUpgrade();
        }
#endif
        if (PollsConfig.selectedHospital != null)
        {
            textSelectedHospital.text  = PollsConfig.selectedHospital.name;
            textSelectedHospital.color = Color.blue;
        }
        else
        {
            textSelectedHospital.text  = "未选定医院";
            textSelectedHospital.color = Color.red;
        }
        if (PollsConfig.selectedDepartment != null)
        {
            textSelecteDepartment.text  = PollsConfig.selectedDepartment.name;
            textSelecteDepartment.color = Color.blue;
        }
        else
        {
            textSelecteDepartment.text  = "未选定科室";
            textSelecteDepartment.color = Color.red;
        }
        if (PollsConfig.selectedHospital != null /*&& PollsConfig.selectedDepartment != null*/)
        {
            //check camera auth
            if (MgrPageController.cameraAuthed == 1 || Application.platform == RuntimePlatform.WindowsEditor)
            {
                btnStart.interactable   = true;
                btnPreview.interactable = true;
            }
        }
        else
        {
            btnStart.interactable   = false;
            btnPreview.interactable = false;
        }
        textNumPeoples.text = "人数 " + PollsConfig.NumPeoples.ToString();
    }
예제 #2
0
        public void MergeFrom(ClientConfigurationMessage other)
        {
            if (other == null)
            {
                return;
            }
            if (other.TargetEnvId.Length != 0)
            {
                TargetEnvId = other.TargetEnvId;
            }
            if (other.ClientVersion.Length != 0)
            {
                ClientVersion = other.ClientVersion;
            }
            if (other.ClientOs != 0)
            {
                ClientOs = other.ClientOs;
            }
            if (other.OsVersion.Length != 0)
            {
                OsVersion = other.OsVersion;
            }
            if (other.DeviceModel.Length != 0)
            {
                DeviceModel = other.DeviceModel;
            }
            if (other.BuildNumber.Length != 0)
            {
                BuildNumber = other.BuildNumber;
            }
            switch (other.DeviceInfoCase)
            {
            case DeviceInfoOneofCase.IosDeviceInfo:
                if (IosDeviceInfo == null)
                {
                    IosDeviceInfo = new global::WUProtos.Networking.Requests.Messages.ClientConfigurationMessage.Types.iOSDeviceInfo();
                }
                IosDeviceInfo.MergeFrom(other.IosDeviceInfo);
                break;

            case DeviceInfoOneofCase.AndroidDeviceInfo:
                if (AndroidDeviceInfo == null)
                {
                    AndroidDeviceInfo = new global::WUProtos.Networking.Requests.Messages.ClientConfigurationMessage.Types.AndroidDeviceInfo();
                }
                AndroidDeviceInfo.MergeFrom(other.AndroidDeviceInfo);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
예제 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TargetEnvId.Length != 0)
            {
                hash ^= TargetEnvId.GetHashCode();
            }
            if (ClientVersion.Length != 0)
            {
                hash ^= ClientVersion.GetHashCode();
            }
            if (ClientOs != 0)
            {
                hash ^= ClientOs.GetHashCode();
            }
            if (OsVersion.Length != 0)
            {
                hash ^= OsVersion.GetHashCode();
            }
            if (DeviceModel.Length != 0)
            {
                hash ^= DeviceModel.GetHashCode();
            }
            if (deviceInfoCase_ == DeviceInfoOneofCase.IosDeviceInfo)
            {
                hash ^= IosDeviceInfo.GetHashCode();
            }
            if (deviceInfoCase_ == DeviceInfoOneofCase.AndroidDeviceInfo)
            {
                hash ^= AndroidDeviceInfo.GetHashCode();
            }
            if (BuildNumber.Length != 0)
            {
                hash ^= BuildNumber.GetHashCode();
            }
            hash ^= (int)deviceInfoCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #4
0
    IEnumerator webAuthPassword(string pwd)
    {
        WWWForm form = new WWWForm();

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            form.AddField("UserName", "user3");
        }
        else
        {
            form.AddField("UserName", AndroidDeviceInfo.GetAndroidId());
        }
        form.AddField("UserPwd", pwd);
        WWW www = new WWW("http://47.106.71.112/api/login.aspx", form);

        yield return(www);

        if (www.isDone && www.error == null)
        {
            var settings = new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            };
            loginRetWithoutData configs = JsonConvert.DeserializeObject <loginRetWithoutData>(www.text, settings);
            if (configs.ret == 1)
            {
                loginRetWithData data = JsonConvert.DeserializeObject <loginRetWithData>(www.text, settings);
                PollsConfig.netUserID     = data.data.iUserID;
                PollsConfig.netUserToken  = data.data.vcToken;
                PollsConfig.netExpireTime = data.data.iExpireDay;
                this.gameObject.SetActive(false);
                mgrPage.gameObject.SetActive(true);
            }
            else
            {
                Toast.ShowToast(configs.info);
            }
        }
        else if (www.error != null)
        {
            Toast.ShowToast("网络连接故障,请稍后重试。");
            Debug.LogError(www.error);
        }
    }
예제 #5
0
 private static void AssertAndroidDeviceInfo(AndroidDeviceInfo deviceInfo)
 {
     Assert.IsNotEmpty(deviceInfo.AdbDeviceId);
     Assert.IsNotEmpty(deviceInfo.DeviceState);
 }
예제 #6
0
    IEnumerator _webExportData(/*exportDataBase64 edb64*/)
    {
        //StartCoroutine(webPostAnswer(edb64.answers, edb64.pics));
        removeList.Clear();
        removeListEx.Clear();
        foreach (KeyValuePair <string, List <PollsConfig.AnswerStorge> > pair in PollsConfig.Answers)
        {
            exportDataBase64         edb64 = new exportDataBase64();
            PollsConfig.AnswerStorge _ans  = pair.Value[0];

            //List<Question> qs = QuestionMap[pair.Value[0].department.questionPath];
            exportData ed = null;
            for (int row = 0; row < pair.Value.Count; row++)
            {
                for (int col = 0; col < pair.Value[0].answers.Count + 6; col++)
                {
                    switch (col)
                    {
                    case 0:
                        ed         = new exportData();
                        ed.Answers = new List <answerExportData>();
                        break;

                    case 1:
                        if (Application.platform == RuntimePlatform.WindowsEditor)
                        {
                            ed.UserID = pair.Value[row].guid + "_" + "a87f814a75bf11dd" + "_" + pair.Value[row].answers[pair.Value[row].answers.Count - 1].endTime.ToString();
                        }
                        else
                        {
                            ed.UserID = pair.Value[row].guid + "_" + AndroidDeviceInfo.GetAndroidId() + "_" + pair.Value[row].answers[pair.Value[row].answers.Count - 1].endTime.ToShortTimeString();
                        }
                        Debug.Log("length " + ed.UserID + "\n" + ed.UserID.Length);
                        break;

                    case 2:
                        break;

                    case 3:
                        System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
                        ed.timestart = (pair.Value[row].answers[0].startTime.Ticks - startTime.Ticks) / 10000;
                        break;

                    case 4:
                        System.DateTime endTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
                        ed.timeend = (pair.Value[row].answers[pair.Value[row].answers.Count - 1].endTime.Ticks - endTime.Ticks) / 10000;
                        break;

                    case 5:
                        break;

                    default:
                        if (pair.Value[row].answers[col - 6].type != 2)
                        {
                            answerExportData aed = new answerExportData();
                            aed.id  = pair.Value[row].answers[col - 6].id;
                            aed.aid = pair.Value[row].answers[col - 6].aid;
                            if (aed.aid == null || aed.aid == "")
                            {
                                aed.aid = "-1";
                            }
                            ed.Answers.Add(aed);
                        }
                        else
                        {
                            UInt32 t = 0;
                            for (int i = 0; i < PollsConfig.MAX_ANS_COUNT; ++i)
                            {
                                if (pair.Value[row].answers[col - 6].answers[i] == 1)
                                {
                                    t += (UInt32)Math.Pow(2, i);
                                }
                            }
                            answerExportData aed = new answerExportData();
                            aed.id  = pair.Value[row].answers[col - 6].id;
                            aed.aid = pair.Value[row].answers[col - 6].aid;
                            if (aed.aid == null || aed.aid == "")
                            {
                                aed.aid = "-1";
                            }
                            ed.Answers.Add(aed);
                        }
                        break;
                    }
                }
                var settings = new JsonSerializerSettings {
                    TypeNameHandling = TypeNameHandling.All
                };
                ed.QuestionnaireID = Int32.Parse(_ans.department.questionID);
                //_ans.department.numPeople = 0;
                ed.HospitalID   = _ans.hospital.hospitalID;
                ed.DepartmentID = _ans.department.departmentID;
                string json  = JsonConvert.SerializeObject(ed);
                byte[] bytes = Encoding.GetEncoding("utf-8").GetBytes(json);
                edb64.answers = Convert.ToBase64String(bytes);
                edb64.pics    = new List <string>();
                for (int i = 0; i < pair.Value[row].photos.Count; ++i)
                {
                    string imgstring;
                    if (departmentPageController.CaptureData != null && i == 0)
                    {
                        imgstring = "data:image / jpg; base64," + Convert.ToBase64String(departmentPageController.CaptureData);
                    }
                    else
                    {
                        imgstring = "data:image / jpg; base64," + Convert.ToBase64String(pair.Value[row].photos[i]);
                    }
                    edb64.pics.Add(imgstring);
                }
                yield return(StartCoroutine(webPostAnswer(edb64.answers, edb64.pics, pair.Key, pair.Value[row].guid)));
            }
        }

        foreach (string key in removeList)
        {
            PollsConfig.Answers[key][0].department.numPeople = 0;
            //
        }
        List <PollsConfig.AnswerStorge> _removeAstList = new List <PollsConfig.AnswerStorge>();

        foreach (KeyValuePair <string, List <string> > pair in removeListEx)
        {
            foreach (string guid in pair.Value)
            {
                for (int i = PollsConfig.Answers[pair.Key].Count - 1; i >= 0; i--)
                {
                    if (PollsConfig.Answers[pair.Key][i].guid == guid)
                    {
                        PollsConfig.Answers[pair.Key].RemoveAt(i);
                    }
                }
            }
            if (PollsConfig.Answers[pair.Key].Count == 0)
            {
                PollsConfig.Answers.Remove(pair.Key);
            }
        }

        if (PollsConfig.Answers.Count == 0)
        {
            Toast.ShowToast(string.Format("导入{0:d}条记录", removeList.Count));
            if (File.Exists(Application.persistentDataPath + "/answer.bin"))
            {
                File.Delete(Application.persistentDataPath + "/answer.bin");
            }
        }
        else
        {
            Toast.ShowToast(string.Format("导入{0:d}条记录, 剩余{1:d}条记录", removeList.Count, PollsConfig.Answers.Count));
            FileStream      fs = new FileStream(Application.persistentDataPath + "/" + "answer.bin", FileMode.OpenOrCreate);
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(fs, PollsConfig.Answers);
            fs.Close();
        }
        PollsConfig.SerializeData();
        loadingPanel.gameObject.SetActive(false);
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
#if UNITY_ANDROID
        androididText.text = AndroidDeviceInfo.GetAndroidId();
#endif
    }