Exemplo n.º 1
0
 void submitData()
 {
     //check all attribute first
     //PopupObject.Button1.OnReleased += getGPS;
     //PopupObject.Button2.OnReleased += nogetGPS;
     if ((name.text != "") && (email.text != "") && (Tel.text != "") && (Detail.text != ""))
     {
         if (flagGPS != 1)
         {
             PopupObject.ShowAlertPopup("แจ้งการขอข้อมูลพิกัดที่อยู่ปัจจุบัน", "ท่านยินยอมให้ระบบส่งพิกัดปัจจุบันของท่านหรือไม่ \n\nท่านสามารถเปลี่ยนแปลงการบันทึกค่าการส่ง\nพิกัดได้ ที่ปุ่ม Settings ที่หน้าเมนูหลัก", "ยินยอม", getGPS, "ไม่ยินยอม", nogetGPS);
         }
         else if (flagPhone != 1)
         {
             PopupObject.ShowAlertPopup("แจ้งการขอข้อมูลเบอร์โทรศัพท์จากเครื่อง", "ท่านยินยอมให้ระบบส่งข้อมูลเบอร์โทรศัพท์\nจากเครื่องของท่านหรือไม่\n\nท่านสามารถเปลี่ยนแปลงการบันทึกค่าการส่ง\nข้อมูลเบอร์โทรศัพท์ได้ ที่ปุ่ม Settings ที่หน้าเมนูหลัก", "ยินยอม", getCellNumber, "ไม่ยินยอม", nogetCellNumber);
         }
         else
         {
             beginSendData();
         }
     }
     else
     {
         PopupObject.ShowAlertPopup("Error", "กรุณาใส่ข้อมูลให้ครบทุกช่อง", "ตกลง");
     }
 }
Exemplo n.º 2
0
 void FinishDownload()
 {
     if (xmlData.contentList.Length > 0)
     {
         for (int i = 0; i < xmlData.contentList.Length; i++)
         {
             GameObject        dtx     = new GameObject("DownloadedTex" + i);
             DownloadedTexture dtxComp = dtx.AddComponent <DownloadedTexture> ();
             dtx.transform.parent = this.transform;
             dtxComp.StartDownload(xmlData.contentList [i].imgthumbnail);
             mDownloadTexList.Add(dtxComp);
         }
         int nextPageSize = Mathf.CeilToInt((float)xmlData.maxPage / PageDetailGlobal.pGlobal.MaxContentPerPage);
         if (nextPageSize != CurrentPageSize)
         {
             CurrentPageSize = nextPageSize;
             FooterBar.ClearPaging();
             FooterBar.CreatePaging(CurrentPageSize);
         }
         ShelfDetail.CreateShelfItem(xmlData.contentList, mDownloadTexList, FooterBar.IsFirstPage(), FooterBar.IsLastPage());
         FullListDetail.CreateItemDetail(xmlData.contentList, mDownloadTexList);
     }
     else
     {
         Indecator.SetActive(false);
         PopupObject.ShowAlertPopup("ไม่พบข้อมูลที่ค้นหา", "กรุณาค้นหาใหม่อีกครั้ง", "ตกลง");
     }
 }
Exemplo n.º 3
0
    public void AddData()
    {
        //Debug.Log("Add Data");
        if (AddFoodName.text != "" && AddFoodCal.text != "")
        {
            AddPage.SetActive(false);
            MainPage.SetActive(true);
            SelectedFood.FoodName  = AddFoodName.text;
            SelectedFood.reciveCal = int.Parse(AddFoodCal.text);
//			SelectedFood.saveDate = DateTime.Now;
            if (!IsEditMode)
            {
                AddBT.SetActive(true);
                EditBT.SetActive(false);
                IsEditMode = false;
                cme.DataFoodList.Add(SelectedFood);
                cme.AddToListData();
            }
            else
            {
                AddBT.SetActive(true);
                EditBT.SetActive(false);

                IsEditMode = false;
                Debug.Log(editFood.FoodName + " " + editPos);
                cme.editToListData(editFood, editPos);
            }
        }
        else
        {
            PopupObject.ShowAlertPopup("กรุณากรอกรายการอาหารและพลังงานที่ได้รับ", "", "ตกลง");
        }
    }
Exemplo n.º 4
0
 public void ShowDownloadChoice(ContentData cData)
 {
     FavData = cData;
     PopupObject.ShowAlertPopup("Favourite", "คุณต้องการ Download รูปแบบไหน?",
                                "ยกเลิก", CancelCB,
                                "บางส่วน", DownloadSomeCB,
                                "ทั้งหมด", DownloadAllCB);
 }
Exemplo n.º 5
0
 void ShowAwardPopup()
 {
     if (awardList == null)
     {
         return;
     }
     if (awardIdx < awardList.Length)
     {
         PopupObject.ShowAlertPopup("Award", StringUtil.ParseUnicodeEscapes(awardList[awardIdx++]), "ปิด", ShowAwardPopup);
     }
 }
Exemplo n.º 6
0
 void PostLogin(string error)
 {
     Debug.Log("LoginPageControl PostLogin : "******"OK")
     {
         PopupObject.ShowAlertPopup("Login Error", "เกิดข้อผิดพลาดในการ Login ด้วย Facebook", "ปิด");
         LoadingScript.HideLoading();
     }
     else
     {
         LoginProcess();
     }
 }
Exemplo n.º 7
0
    private void OnUserDataLoadFailed()
    {
        PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                   "ไม่สามารถตรวจสอบข้อมูลของท่านได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                   "ยกเลิก", null,
                                   "เชื่อมต่อใหม่", LoadUserData);

        Debug.Log("Load UserData failed.");
        if (PostLogin != null)
        {
            PostLogin("UNKNOWED");
        }
    }
Exemplo n.º 8
0
 void PressFav()
 {
     if (cData != null)
     {
         if (!cData.IsFav)
         {
             PageDetailGlobal.AddFavourite(cData);
         }
         else
         {
             PopupObject.ShowAlertPopup("Error", "ข้อมูลนี้ได้ถูกบันทึกไปแล้ว", "ปิด");
         }
     }
 }
Exemplo n.º 9
0
    public IEnumerator DownloadJSON(string url)
    {
        WWWForm form = new WWWForm();

        Debug.Log("Search " + rtype + ", " + rnumber + ", " + UserCommonData.pGlobal.user.user_id);
        form.AddField("user_id", UserCommonData.pGlobal.user.user_id);
        form.AddField("code", rnumber);
        www = new WWW(url, form);
        Debug.Log("Start Download JSON Register : " + url);
        yield return(new WaitForSeconds(3f));

        while (!www.isDone)
        {
            yield return(null);
        }
        yield return(www);

        /* EDIT: */
        if (!string.IsNullOrEmpty(www.error))
        {
            PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                       "ไม่สามารถลงทะเบียนได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                       "ตกลง", null);
            Debug.LogWarning("LOCAL FILE ERROR: " + www.error);
        }
        else
        {
            //JSONObject j = new JSONObject(www.text);
            Debug.Log(www.text);

            if (www.text != null)
            {
                resultRegis = www.text;
            }
            else
            {
                resultRegis = "0";
            }
            isFinish = true;
            OryorActivityData data = new OryorActivityData();
            data.result = www.text;
            Debug.Log("Register Activity Result " + rtype + " : " + data.result);
            contentList = data;
            if (postDownloaded != null)
            {
                Debug.Log("postDownloaded");
                postDownloaded();
            }
        }
    }
Exemplo n.º 10
0
    void AcceptLicense()
    {
        if (IsTickAccept)
        {
            UserCommonData.SetAG(true);
//			AgreementDrag.onAcceptLicense = false;
//			StopCoroutine ("Popout");
//			StartCoroutine ("Popout");this.gameObject.SetActive(false);
            this.gameObject.SetActive(false);
        }
        else
        {
            PopupObject.ShowAlertPopup("ไม่สามารถไปต่อได้", "กรุณากดยอมรับข้อตกลงก่อนใช้งาน", "ตกลง");
        }
    }
Exemplo n.º 11
0
    void nogetGPS()
    {
        lat = "";
        lon = "";

        flagGPS = 0;
        if (flagPhone != 1)
        {
            PopupObject.ShowAlertPopup("แจ้งการขอข้อมูลเบอร์โทรศัพท์จากเครื่อง", "ท่านยินยอมให้ระบบส่งข้อมูลเบอร์โทรศัพท์\nจากเครื่องของท่านหรือไม่\n\nท่านสามารถเปลี่ยนแปลงการบันทึกค่าการส่ง\nข้อมูลเบอร์โทรศัพท์ได้ ที่ปุ่ม Settings ที่หน้าเมนูหลัก", "ยินยอม", getCellNumber, "ไม่ยินยอม", nogetCellNumber);
        }
        else
        {
            beginSendData();
        }
    }
Exemplo n.º 12
0
    void AddFavourite()
    {
        if (cData != null)
        {
            mSound.playContentSound("click");

            if (!cData.IsFav)
            {
                PageDetailGlobal.AddFavourite(cData);
            }
            else
            {
                PopupObject.ShowAlertPopup("Error", "ข้อมูลนี้ได้ถูกบันทึกไปแล้ว", "ปิด");
            }
        }
    }
Exemplo n.º 13
0
 public void PostDownload()
 {
     dbs = gLoader.awardList;
     if (gLoader.awardList.allGameData[0] == null)
     {
         PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                    "ไม่สามารถตรวจสอบข้อมูลของท่านได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                    "ยกเลิก", null,
                                    "เชื่อมต่อใหม่", LoadAward);
     }
     else
     {
         AllGameAward();
     }
     LoadingScript.HideLoading();
 }
Exemplo n.º 14
0
 void PostLoginFB(string Error)
 {
     if (Error == "OK")
     {
         UserCommonData.IsFBLogin = true;
         UserCommonData.pGlobal.Save();
         PopupObject.ShowAlertPopup("Login Success", "Login สำเร็จ",
                                    "ปิด", LoadRank);
     }
     else
     {
         PopupObject.ShowAlertPopup("Facebook Error", "ไม่สามารถนำรายชื่อเพื่อนจาก Facebook ได้ กรุณา Login ผ่าน Facebook ก่อน",
                                    "ปิด", CloseRanking,
                                    "Login", LoginFB);
     }
 }
Exemplo n.º 15
0
 void GetFriendCB(string Error)
 {
     FriendIsDone = true;
             #if UNITY_WINRT
     Debug.Log("getFrendCB");
     if (Error != null)
     {
         Loading(Error);
     }
     else
     {
         GetFriendClose();
     }
             #else
     if (Error == "OK")
     {
         FriendIsDone = true;
         int    i            = 0;
         string friendString = "";
         foreach (FB_UserInfo friend in FacebookLogin.pGlobal.mFriendList)
         {
             if (i != 0)
             {
                 friendString += ",";
             }
             friendString += friend.Id;
             i++;
         }
         Loading(friendString);
     }
     else if (Error == "NOAUTH")
     {
         //no login
         //close and popup menu to ask to login
         GetFriendClose();
     }
     else
     {
         //Unknowed error
         PopupObject.ShowAlertPopup("Facebook Error", "มีปัญหาจากการเชื่อมต่อกับ Facebook เชื่อมต่ออีกครั้งหรือไม่?",
                                    "ปิด", GetFriendClose,
                                    "ลองใหม่", GetFriendList);
     }
             #endif
 }
Exemplo n.º 16
0
 public void DownloadSomeCB()
 {
     if (!pGlobal.file.AddContentToFile(FavData, false))
     {
         PopupObject.ShowAlertPopup("Error", "ข้อมูลนี้ได้ถูกบันทึกไปแล้ว", "ปิด");
     }
     else
     {
         state = DetailState.DS_WAITING;
         pGlobal.StartLoading();
     }
             #if !UNITY_WEBGL && !DISABLE_WEBVIEW
     if (pGlobal.pchk)
     {
         contentPage.webviewshow();
     }
             #endif
 }
Exemplo n.º 17
0
    // Update is called once per frame
    void Update()
    {
        bool    touchedDown = TouchInterface.GetTouchDown();
        bool    touchedUp   = TouchInterface.GetTouchUp();
        Vector2 touchPos    = TouchInterface.GetTouchPosition();

        if (touchedDown)
        {
            if (this.GetComponent <Collider2D>().OverlapPoint(touchPos))
            {
                //run event here
                PopupObject.ShowAlertPopup(HeaderText, DetailText, ButtonText);
//				StopCoroutine("TestTiming");
//				StartCoroutine("TestTiming");
//				PopupObject.ShowWaitingPopup(HeaderText,"Cancel",ProgressCB,Cancel);
            }
        }
    }
Exemplo n.º 18
0
 void FavButtonPress()
 {
     mSound.playContentSound("click");
     if (currentData != null)
     {
                     #if !UNITY_WEBGL && !DISABLE_WEBVIEW
         webviewhide();
         if (!currentData.IsFav)
         {
             PageDetailGlobal.AddFavourite(currentData, IsWeb);
         }
         else
         {
             PopupObject.ShowAlertPopup("Error", "ข้อมูลนี้ได้ถูกบันทึกไปแล้ว", "ปิด", webviewhide);
         }
                     #endif
     }
 }
Exemplo n.º 19
0
 void UpdateCB(APIMsg msg)
 {
     //done update
     //check msg first
     if (msg.msg == "OK")
     {
         //update UserCommonData and save
         UserCommonData.pGlobal.user = msg.user[0];
         UserCommonData.pGlobal.Save();
     }
     else
     {
         //update error
         PopupObject.ShowAlertPopup("Update Error", "ไม่สามารถปรับปรุงข้อมูลได้", "ปิด");
         //reset data
         ResetUpdateDataForm();
     }
     LoadingScript.HideLoading();
 }
Exemplo n.º 20
0
 void RegisResult()
 {
     if (RegisGlobal.contentList.result == "Not Found Activity")
     {
         PopupObject.ShowAlertPopup("ไม่สามารถลงทะเบียนได้",
                                    "ไม่พบรหัสลงทะเบียนที่กรอก กรุณาตรวจสอบรหัสลงทะเบียน และลองใหม่อีกครั้ง",
                                    "ตกลง", null);
     }
     else if (RegisGlobal.contentList.result == "User Already Regis Activity")
     {
         PopupObject.ShowAlertPopup("ไม่สามารถลงทะเบียนได้",
                                    "ท่านได้ร่วมสนุกกับทางสำนักงานคณะกรรมการอาหารและยาเป็นที่เรียบร้อย จึงไม่สามารถร่วมสนุกอีกครั้งได้",
                                    "ตกลง", CheckDisable);
     }
     else if (RegisGlobal.contentList.result == "Not Found User")
     {
         PopupObject.ShowAlertPopup("ไม่สามารถลงทะเบียนได้",
                                    "",
                                    "ตกลง", null);
     }
     else if (RegisGlobal.contentList.result == "success")
     {
         if (RegisGlobal.rtype == "school")
         {
             UserCommonData.SetActivity(true, schoolTextInput.text);
             PopupObject.ShowAlertPopup("ลงทะเบียนเรียบร้อย", "สำนักงานคณะกรรมการอาหารและยาขอขอบคุณ ที่ได้มาลงทะเบียนร่วมสนุกกับเรา", "ตกลง", SchoolConfirm);
         }
         else
         {
             UserCommonData.SetOryor(true, oryorTextInput.text);
             PopupObject.ShowAlertPopup("ลงทะเบียนเรียบร้อย", "สำนักงานคณะกรรมการอาหารและยาขอขอบคุณ ที่ได้มาลงทะเบียนร่วมสนุกกับเรา", "ตกลง", OryorConfirm);
         }
     }
     else
     {
         PopupObject.ShowAlertPopup("เกิดความผิดพลาด", "กรุณาลองใหม่อีกครั้ง", "ตกลง", OryorConfirm);
     }
 }
Exemplo n.º 21
0
    public IEnumerator DownloadJSON(string url)
    {
        WWWForm form = new WWWForm();

        Debug.Log("Search " + filter);
        form.AddField("filter", filter);
        form.AddField("user_id", UserCommonData.pGlobal.user.user_id);
        www = new WWW(url, form);
        Debug.Log("Start Download JSON : " + url);
        yield return(new WaitForSeconds(3f));

        while (!www.isDone)
        {
            yield return(null);
        }
        yield return(www);

        /* EDIT: */
        if (!string.IsNullOrEmpty(www.error))
        {
            PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                       "ไม่สามารถตรวจสอบข้อมูลของท่านได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                       "ตกลง", null);
            Debug.LogWarning("LOCAL FILE ERROR: " + www.error);
        }
        else
        {
            JSONObject j = new JSONObject(www.text);
            if (j["MAX"].str != null)
            {
                maxPage = int.Parse(j["MAX"].str);
            }
            else
            {
                maxPage = 0;
            }
            JSONObject arr = j["Result"];
            Debug.Log(arr);
            if (arr.list != null)
            {
                contentList = new ContentData[arr.list.Count];
            }
            else
            {
                contentList = null;
            }
            //loop for Result
            int i = 0;
            foreach (JSONObject content in arr.list)
            {
                ContentData data = new ContentData();
                data.dataid = int.Parse(content["dataid"].str);
                //				data.title = ParseUnicodeEscapes(content["title"].str);
                data.title = content["title"].str.Replace(@"\/", @"/");
                data.type  = int.Parse(content["type"].str);
                JSONObject detailList = content["detail"];
                data.detail = new string[detailList.list.Count];
                int k = 0;
                foreach (JSONObject detail in detailList.list)
                {
                    //					string detailText = ParseUnicodeEscapes(detail.str);
                    string detailText;
                    if (detail.str != null)
                    {
                        detailText = detail.str.Replace(@"< br \/ >", @"\n").Replace(@"\r", @"").Replace(@"& quot ;", @"'");
                    }
                    else
                    {
                        detailText = detail.str;
                    }

                    data.detail[k] = detailText.Replace(@"\/", @"/");
                    k++;
                }
                data.imgthumbnail = content["imgthumbnail"].str.Replace(@"\/", @"/");
                JSONObject imgList = content["img"];
                data.img = new string[imgList.list.Count];
                k        = 0;
                if (imgList != null)
                {
                    foreach (JSONObject img in imgList.list)
                    {
                        string imgURL = img.str.Replace(@"\/", @"/");
                        data.img[k] = imgURL;
                        k++;
                    }
                }
                data.vdourl = StringUtil.ParseUnicodeEscapes(content["vdourl"].str.Replace(@"\/", @"/"));
                //audiourl not use now.
                data.audiourl = StringUtil.ParseUnicodeEscapes(content["audiourl"].str.Replace(@"\/", @"/"));
                data.pdfurl   = StringUtil.ParseUnicodeEscapes(content["pdfurl"].str.Replace(@"\/", @"/"));
                //gameurl not use now.
                data.gameurl     = content["gameurl"].str;
                data.view        = int.Parse(content["view"].str);
                data.like        = int.Parse(content["like"].str);
                data.publishdate = content["publishdate"].str;
                data.publishby   = content["publishby"].str;
                data.recommend   = (int)content["recommend"].n;
                data.weburl      = StringUtil.ParseUnicodeEscapes(content["weburl"].str.Replace(@"\/", @"/"));
                contentList[i]   = data;
                i++;
            }
            isFinish = true;
            if (postDownloaded != null)
            {
                postDownloaded();
            }
        }
    }
Exemplo n.º 22
0
    public IEnumerator DownloadJSON(string url)
    {
        url = UserCommonData.GetURL() + url + "&type=0&offset=0&limit=9&sort=0&cat=0";
        www = new WWW(url);
        Debug.Log("Start Download News Board JSON : " + url);
        yield return(new WaitForSeconds(3f));

        while (!www.isDone)
        {
            yield return(null);
        }
        yield return(www);

        /* EDIT: */
        if (!string.IsNullOrEmpty(www.error))
        {
            PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                       "ไม่สามารถตรวจสอบข้อมูลของท่านได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                       "ตกลง", null);
            Debug.LogWarning("LOCAL FILE ERROR: " + www.error);
        }
        else
        {
            JSONObject j = new JSONObject(www.text);
            Debug.Log("JSONObject : " + www.text);
            JSONObject arr = j["Result"];
            Debug.Log("All News : " + arr.list.Count);
            contentList = new NewsboardDetail[arr.list.Count];
            //loop for Result
            int i = 0;
            foreach (JSONObject content in arr.list)
            {
                NewsboardDetail data = new NewsboardDetail();
                data.title = StringUtil.ParseUnicodeEscapes(content["title"].str);
//				data.desc = content["desc"].str;
                JSONObject descList = content["desc"];
                data.desc = new string[descList.list.Count];
                int k = 0;
                if (descList != null)
                {
                    foreach (JSONObject desc in descList.list)
                    {
                        string tempdesc = desc.str.Replace(@"\/", @"/");
                        data.desc[k] = tempdesc;
                        k++;
                    }
                }
                JSONObject imgList = content["img"];
                data.img = new string[imgList.list.Count];
                k        = 0;
                if (imgList != null)
                {
                    foreach (JSONObject img in imgList.list)
                    {
                        string tempimg = img.str.Replace(@"\/", @"/");
                        data.img[k] = tempimg;
                        k++;
                    }
                }
                data.status    = content["status"].str;
                data.type      = content["type"].str;
                data.date      = content["date"].str;
                data.link_web  = content["link_web"].str;
                data.hot       = content["hot"].str;
                data.pin       = content["pin"].str;
                contentList[i] = data;
                i++;
            }
            isFinish = true;
            if (postDownloaded != null)
            {
                postDownloaded();
            }
        }
    }
Exemplo n.º 23
0
    IEnumerator SendData()
    {
        LoadingScript.ShowLoading();
        WWWForm form    = new WWWForm();
        string  wwwText = UserCommonData.GetURL();

        //http://www.oryor.com/oryor_smart_app_year2/ws_client_year2v1.php?task=inform&
        //email=xxx&number=xxx&name=xxx&tel=xxx&detail=xxx&lat=xxx&lon=xxx&file1=&file2=&file3=
        form.AddField("task", "inform");
        form.AddField("user_id", UserCommonData.pGlobal.user.user_id);
        form.AddField("type", type.currentIdx);
        form.AddField("name", name.text);
        form.AddField("email", email.text);
        form.AddField("tel", Tel.text);
        form.AddField("detail", Detail.text);
        if (flagGPS == 1)
        {
            form.AddField("lat", lat);
            form.AddField("lon", lon);
        }
        else
        {
            form.AddField("lat", "");
            form.AddField("lon", "");
        }
        if (flagPhone == 1)
        {
            form.AddField("phone", phonenumber);
        }
        else
        {
            form.AddField("phone", "");
        }

        int i = 1;

        foreach (ReportPicSrc src in ReportCamera.PictureList)
        {
            string attr = "file" + i;
            Debug.Log(attr);
            Debug.Log(src.rawData);
            form.AddBinaryData(attr, src.rawData, attr + ".jpeg", "image/jpeg");
            i++;
        }

        WWW upload = new WWW(wwwText, form);

        yield return(upload);

        LoadingScript.HideLoading();
        if (!string.IsNullOrEmpty(upload.error))
        {
            PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                       "ไม่สามารถส่งข้อมูลของท่านไปยังเจ้าหน้าที่ได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                       "ตกลง", null);
            Debug.LogWarning("LOCAL FILE ERROR: " + upload.error);
        }
        else
        {
            Debug.Log(upload.text);
            Debug.Log("Uploaded Finish");
            PopupObject.ShowAlertPopup("ระบบได้รับเรื่องร้องเรียนของท่านเรียบร้อยแล้ว", "ขอขอบคุณสำหรับข้อมูลที่มีประโยชน์ของท่าน ทางสำนักงานคณะกรรมการอาหารและยา จะดำเนินการตรวจสอบและแก้ไขโดยเร็วที่สุด", "ตกลง");
        }
    }
Exemplo n.º 24
0
    // Update is called once per frame
    void Update()
    {
        bool         touchedDown = TouchInterface.GetTouchDown();
        bool         touchedUp   = TouchInterface.GetTouchUp();
        Vector2      touchPos    = TouchInterface.GetTouchPosition();
        RaycastHit2D hit         = Physics2D.Raycast(touchPos, Vector2.zero);

        if (touchedDown)
        {
            if (mCollider.OverlapPoint(touchPos))
            {
                //show button
                mSound.playBMISound("click");
                if (AgeInput.text != "" && HeightInput.text != "" && WeightInput.text != "")
                {
                    ResultLayer.SetActive(true);
                    foreach (GameObject bubble in BMIBubble)
                    {
                        bubble.SetActive(false);
                    }
                    foreach (GameObject picture in BMIPicture)
                    {
                        picture.SetActive(false);
                    }
                    //Header.SetActive(false);
                    Detail.SetActive(false);
                    string txt = AgeInput.text.Replace(" ", "");
                    age    = int.Parse(txt);
                    txt    = HeightInput.text.Replace(" ", "");
                    height = float.Parse(txt);
                    txt    = WeightInput.text.Replace(" ", "");
                    weight = float.Parse(txt);

                    if (height > 100)
                    {
                        height = height / 100;
                    }

                    bmival = weight / (height * height);
                    if (sex)
                    {
                        bmrval = (float)(66 + (13.7 * weight) + (5 * height * 100) - (6.8 * age));
                    }
                    else
                    {
                        bmrval = (float)(665 + (9.6 * weight) + (1.8 * height * 100) - (4.7 * age));
                    }

                    if (activityChoose == 0)
                    {
                        burncal = (float)(bmrval * 1.2);
                    }
                    else if (activityChoose == 1)
                    {
                        burncal = (float)(bmrval * 1.375);
                    }
                    else if (activityChoose == 2)
                    {
                        burncal = (float)(bmrval * 1.55);
                    }
                    else if (activityChoose == 3)
                    {
                        burncal = (float)(bmrval * 1.725);
                    }
                    else if (activityChoose == 4)
                    {
                        burncal = (float)(bmrval * 1.9);
                    }

                    BMIDetailBT.SetActive(false);
                    BMRDetailBT.SetActive(true);
                    BMIResult.settingResult(bmival, bmrval, burncal);
                }
                else
                {
                    PopupObject.ShowAlertPopup("ท่านกรอกข้อมูลไม่ครบถ้วน", "กรุณากรอกอายุ ส่วนสูง และน้ำหนักให้ครบ", "ตกลง", null);
                }

                //Debug.Log(sex+" "+age+" "+height+" "+weight+" "+bmival);
            }
            if (mArrowRight.OverlapPoint(touchPos))
            {
                mSound.playBMISound("click");
                if (activityChoose < (activityName.Length - 1))
                {
                    activityChoose++;
                }
                else
                {
                    activityChoose = 0;
                }
                Activities.text = activityName[activityChoose];
            }
            if (mArrowLeft.OverlapPoint(touchPos))
            {
                mSound.playBMISound("click");
                if (activityChoose > 0)
                {
                    activityChoose--;
                }
                else
                {
                    activityChoose = activityName.Length - 1;
                }
                Activities.text = activityName[activityChoose];
            }
        }
    }
Exemplo n.º 25
0
    IEnumerator FBLoginAPIProcess()
    {
        if (!UserCommonData.IsLogin)
        {
                        #if UNITY_WINRT
            WWWForm form = new WWWForm();
            form.AddField("type", "userRegisterWithFB");
            form.AddField("fbid", mWP8FBUser.userId);
            form.AddField("imei", UserCommonData.imei);
            form.AddField("username", mWP8FBUser.email);
            form.AddField("name", mWP8FBUser.firstName);
            form.AddField("surname", mWP8FBUser.lastName);
            form.AddField("tel", "");
            form.AddField("address", "");
            FBLoginAPI.wwwCallAPI(form);
                        #else
            Debug.Log("Register FB : " + FacebookLogin.UserID);
            //			Debug.Log("User Email : "+FacebookLogin.pGlobal.myInfo.email);
            //register with FB
            WWWForm form = new WWWForm();
            form.AddField("type", "userRegisterWithFB");
            form.AddField("fbid", FacebookLogin.UserID);
            form.AddField("imei", UserCommonData.imei);
            form.AddField("username", FacebookLogin.pGlobal.myInfo.Email);
            form.AddField("name", FacebookLogin.pGlobal.myInfo.FirstName);
            form.AddField("surname", FacebookLogin.pGlobal.myInfo.LastName);
            form.AddField("tel", "");
            form.AddField("address", "");
            FBLoginAPI.wwwCallAPI(form);
                        #endif


//			UpdateDataFormFB();
//			ResetUpdateDataForm();
//			ResetRegisterDataForm();
            while (!FBLoginAPI.IsDone)
            {
//				LoadingScript.HideLoading();
                yield return(null);
            }
            Debug.Log("Done Login");
            //decrypt all data to UserCommonData
            if (FBLoginAPI.IsError)
            {
                LoadingScript.HideLoading();
                PopupObject.ShowAlertPopup("Server Error", "ไม่สามารถเชื่อมต่อกับ Server อย. ได้",
                                           "ลองใหม่", LoginProcess);
                yield break;
            }
            else if (FBLoginAPI.msg.msg != "OK")
            {
                LoadingScript.HideLoading();
                PopupObject.ShowAlertPopup("Server Error", "มีข้อผิดพลาดกับการส่งข้อมูลกับทาง Server",
                                           "ปิด");
//				PopupObject.ShowAlertPopup(FacebookLogin.UserID,UserCommonData.imei+" "+FacebookLogin.pGlobal.myInfo.email,
//				                           "ปิด");
                yield break;
            }
            else
            {
                Debug.Log("No Error Register Facebook");
                UserCommonData.pGlobal.user = FBLoginAPI.msg.user[0];
                UserCommonData.IsLogin      = true;
                UserCommonData.IsFBLogin    = true;
                if (FacebookLogin.IsLogin)
                {
                    btLoginFB.gameObject.SetActive(false);
                }
                else
                {
                    btLoginFB.gameObject.SetActive(true);
                }
                //setup User here
                UpdateDataFormFB();
                ResetUpdateDataForm();
                ResetRegisterDataForm();
                UserCommonData.pGlobal.Save();
                LoadingScript.HideLoading();
            }
        }
        else
        {
                        #if UNITY_WINRT
            WWWForm form = new WWWForm();
            form.AddField("type", "userUpdate");
            form.AddField("user_id", UserCommonData.pGlobal.user.user_id);
            form.AddField("fbid", mWP8FBUser.userId);
            form.AddField("imei", UserCommonData.imei);
            form.AddField("username", mWP8FBUser.email);
            form.AddField("name", mWP8FBUser.firstName);
            form.AddField("surname", mWP8FBUser.lastName);
            form.AddField("tel", UserCommonData.pGlobal.user.user_tel);
            form.AddField("address", UserCommonData.pGlobal.user.user_address);
            FBUpdateAPI.wwwCallAPI(form);
                        #else
            Debug.Log("Update FB : " + FacebookLogin.UserID);
            //update with FB
            WWWForm form = new WWWForm();
            form.AddField("type", "userUpdate");
            form.AddField("user_id", UserCommonData.pGlobal.user.user_id);
            form.AddField("fbid", FacebookLogin.UserID);
            form.AddField("imei", UserCommonData.imei);
            form.AddField("username", FacebookLogin.pGlobal.myInfo.Email);
            form.AddField("name", FacebookLogin.pGlobal.myInfo.FirstName);
            form.AddField("surname", FacebookLogin.pGlobal.myInfo.LastName);
            form.AddField("tel", UserCommonData.pGlobal.user.user_tel);
            form.AddField("address", UserCommonData.pGlobal.user.user_address);
            FBUpdateAPI.wwwCallAPI(form);
                        #endif


//			UpdateDataFormFB();
//			ResetUpdateDataForm();
//			ResetRegisterDataForm();
            while (!FBUpdateAPI.IsDone)
            {
                yield return(null);
            }
            //decrypt all data to UserCommonData
            if (FBUpdateAPI.IsError)
            {
                LoadingScript.HideLoading();
                PopupObject.ShowAlertPopup("Server Error", "ไม่สามารถเชื่อมต่อกับ Server อย. ได้",
                                           "ลองใหม่", LoginProcess);
                yield break;
            }
            else if (FBUpdateAPI.msg.msg != "OK")
            {
                LoadingScript.HideLoading();
                PopupObject.ShowAlertPopup("Server Error", "มีข้อผิดพลาดกับการส่งข้อมูลกับทาง Server",
                                           "ปิด");
//				PopupObject.ShowAlertPopup(FacebookLogin.UserID,UserCommonData.imei+" "+FacebookLogin.pGlobal.myInfo.email+" "+FBUpdateAPI.msg.msg,
//				                           "ปิด");
                yield break;
            }
            else
            {
                UserCommonData.pGlobal.user = FBUpdateAPI.msg.user[0];
                UserCommonData.IsLogin      = true;
                UserCommonData.IsFBLogin    = true;
                if (FacebookLogin.IsLogin)
                {
                    btLoginFB.gameObject.SetActive(false);
                }
                else
                {
                    btLoginFB.gameObject.SetActive(true);
                }
                //setup User here
                UpdateDataFormFB();
                ResetUpdateDataForm();
                ResetRegisterDataForm();
                UserCommonData.pGlobal.Save();
                LoadingScript.HideLoading();
            }

//			LoadingScript.HideLoading();
        }
        ResetUpdateDataForm();
        ResetRegisterDataForm();
    }
Exemplo n.º 26
0
    IEnumerator InitializeApplication()
    {
                #if !UNITY_WEBGL && !DISABLE_WEBVIEW
        //Check IMEI
        if (!UserCommonData.IsLogin)
        {
            UserCommonData.pGlobal.Load();
            IsChecked = false;
            WWWForm form = new WWWForm();
            form.AddField("type", "getLogin");
            form.AddField("imei", UserCommonData.imei);
            api.wwwCallAPI(form);
            Debug.Log("apiCall " + UserCommonData.imei);
            while (!IsChecked)
            {
                yield return(null);
            }
            if (api.msg.msg == "OK")
            {
                //pull all UserData here
                UserCommonData.SetUserData(api.msg.user[0]);
                LoadingScript.ChangeScene("MainMenu");
            }
            else
            {
                if ((api.IsError) && (!UserCommonData.IsLogin))
                {
                    //popup and break;
                    PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ", "กรุณาลองใหม่อีกครั้ง", "ตกลง", initApp);
                    yield break;
                }
            }
        }
        if (UserCommonData.IsSoundOn())
        {
            AudioListener.volume = 1.0f;
        }
        else
        {
            AudioListener.volume = 0.0f;
        }

        //		while(!FacebookLogin.IsInit)
        //		{
        //			yield return null;
        //		}
        //LoadingNewScene
        Debug.Log("IsFacebookLogin : "******"MainMenu");
                #else
        //Check IMEI
        {
            IsChecked = false;
            //api.wwwCallAPI(form,false);
            string getForm = "&type=getLoginWeb&user_id=" + UserCommonData.imei;
            api.wwwCallAPINoForm(getForm);
            Debug.Log("apiCall " + UserCommonData.imei);
            while (!IsChecked)
            {
                yield return(null);
            }
            if (api.msg.msg == "OK")
            {
                //pull all UserData here
                UserCommonData.SetUserData(api.msg.user[0]);
            }
            else
            {
                if (api.IsError)
                {
                    //popup and break;
                    PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ", "กรุณาลองใหม่อีกครั้ง", "ตกลง", initApp);
                    yield break;
                }
            }
        }
        LoadingScript.ChangeScene("GameLand");
                #endif
        yield return(null);
    }
Exemplo n.º 27
0
    IEnumerator ICallAPINoForm(string getForm)
    {
        //create postform
        baseURL = UserCommonData.GetURL();
        WWW api;

        api = new WWW(baseURL + page + getForm);
        Debug.Log("Call API NO Form : " + api.url);
        while (!api.isDone)
        {
            //waiting
            yield return(null);
        }
        IsDone = true;
        if (api.error != null)
        {
            IsError = true;
            Debug.Log("Error : " + api.error);
            //			PopupObject.ShowAlertPopup("Error",api.error,"ปิด",errorMethod);
            PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ", "กรุณาเชื่อมต่อ  อินเทอเน็ตเพื่อเข้าใช้งาน  Oryor  Smart  Application", "เชื่อมต่อ", errorMethod);
            yield break;
        }
        //decrypt msg
        Debug.Log(api.text);
        JSONObject json = new JSONObject(api.text);

        if (json["msg"] != null)
        {
            msg.msg = json["msg"].str;
            if (msg.msg == "OK")
            {
                JSONObject userArr = json["user"];
                if (userArr != null)
                {
                    List <UserData> userList = new List <UserData>();
                    foreach (JSONObject user in userArr.list)
                    {
                        UserData dat = new UserData();
                        dat.user_id        = user["user_id"].str;
                        dat.user_address   = user["user_address"].str;
                        dat.user_picture   = user["user_picture"].str;
                        dat.user_email     = user["user_email"].str;
                        dat.user_firstname = user["user_firstname"].str;
                        dat.user_surname   = user["user_surname"].str;
                        dat.user_location  = user["user_location"].str;
                        dat.user_tel       = user["user_tel"].str;

                        dat.user_money = user["user_money"].str;

                        dat.user_level = user["user_level"].str;
                        //naming notice
                        //coin means item plus score
                        //score means item plus exp
                        //F**K THE NAMING SERVER!!!
                        dat.user_item1 = user["user_item_heart_no"].str;
                        dat.user_item2 = user["user_item_coin_no"].str;
                        dat.user_item3 = user["user_item_score_no"].str;

                        dat.user_int_exp  = user["user_int_exp"].str;
                        dat.user_exp      = user["user_exp"].str;
                        dat.user_next_exp = user["user_next_exp"].str;

                        dat.user_exp_plus     = user["user_exp_plus"].str;
                        dat.user_coin_plus    = user["user_coin_plus"].str;
                        dat.user_score_plus   = user["user_score_plus"].str;
                        dat.user_hardmode     = user["user_hardmode"].str;
                        dat.user_unlock_item1 = user["user_unlock_item1"].str;
                        dat.user_unlock_item2 = user["user_unlock_item2"].str;
                        dat.user_unlock_item3 = user["user_unlock_item3"].str;

                        dat.user_date_regis  = user["user_date_regis"].str;
                        dat.user_date_update = user["user_date_update"].str;

                        userList.Add(dat);
                    }
                    msg.user = userList.ToArray();
                }
            }
        }
        if (apiCB != null)
        {
            apiCB(msg);
        }
    }
Exemplo n.º 28
0
 void popupAction()
 {
     PopupObject.ShowAlertPopup("Award", popupTxt, "ปิด");
 }
Exemplo n.º 29
0
    void SchoolButtonPress()
    {
//		Debug.Log ("SchoolActivity Input : "+schoolTextInput.text);
        MainMenuGlobal.SetState(MainMenuState.MS_SETTING);
        PopupObject.ShowAlertPopup("ท่านต้องการลงทะเบียนเพื่อเข้าร่วมกิจกรรมหรือไม่", "ถ้าหากท่านได้ลงทะเบียนเข้าร่วมกิจกรรมแล้วท่านจะไม่สามารถลงทะเบียนซ้ำได้", "ตกลง", SchoolRegisAcitivity, "ยกเลิก", null);
    }
Exemplo n.º 30
0
 void GetFriendCB(string Error)
 {
             #if UNITY_WINRT
     if (Error != null)
     {
         StartCoroutine("Loading", Error);
     }
     else
     {
         LoadingScript.HideLoading();
         PopupObject.ShowAlertPopup("Facebook Error", "ไม่สามารถนำรายชื่อเพื่อนจาก Facebook ได้ กรุณา Login ผ่าน Facebook ก่อน",
                                    "ปิด", CloseRanking,
                                    "Login", LoginFB, Error, null);
     }
             #elif UNITY_WEBGL
     if (Error == "OK")
     {
         int    i            = 0;
         string friendString = "";
         foreach (string friend in FacebookLogin.pGlobal.friendIDList)
         {
             if (i != 0)
             {
                 friendString += ",";
             }
             friendString += friend;
             i++;
         }
         StartCoroutine("Loading", friendString);
     }
     else if (Error == "NOAUTH")
     {
         //no login
         //close and popup menu to ask to login
         LoadingScript.HideLoading();
         PopupObject.ShowAlertPopup("Facebook Error", "ไม่สามารถนำรายชื่อเพื่อนจาก Facebook ได้ กรุณา Login ผ่าน Facebook ก่อน",
                                    "ปิด", CloseRanking,
                                    "Login", LoginFB);
     }
     else
     {
         //Unknowed error
         LoadingScript.HideLoading();
         //PopupObject.ShowAlertPopup("Facebook Error","มีปัญหาจากการเชื่อมต่อกับ Facebook",
         //                          "ปิด",);
         PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                    "ไม่สามารถตรวจสอบข้อมูลของท่านได้ กรุณาตรวจสอบอินเทอเน็ตของท่าน และลองใหม่อีกครั้ง",
                                    "ยกเลิก", CloseRanking,
                                    "เชื่อมต่อใหม่", LoadRank);
     }
             #else
     if (Error == "OK")
     {
         int    i            = 0;
         string friendString = "";
         foreach (FB_UserInfo friend in FacebookLogin.pGlobal.mFriendList)
         {
             if (i != 0)
             {
                 friendString += ",";
             }
             friendString += friend.Id;
             i++;
         }
         StartCoroutine("Loading", friendString);
     }
     else if (Error == "NOAUTH")
     {
         //no login
         //close and popup menu to ask to login
         LoadingScript.HideLoading();
         PopupObject.ShowAlertPopup("Facebook Error", "ไม่สามารถนำรายชื่อเพื่อนจาก Facebook ได้ กรุณา Login ผ่าน Facebook ก่อน",
                                    "ปิด", CloseRanking,
                                    "Login", LoginFB);
     }
     else
     {
         //Unknowed error
         LoadingScript.HideLoading();
         //PopupObject.ShowAlertPopup("Facebook Error","มีปัญหาจากการเชื่อมต่อกับ Facebook",
         //                          "ปิด",);
         PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ",
                                    "ไม่สามารถตรวจสอบข้อมูลของท่านได้ กรุณาตรวจสอบอินเทอร์เน็ตของท่าน และลองใหม่อีกครั้ง",
                                    "ยกเลิก", CloseRanking,
                                    "เชื่อมต่อใหม่", LoadRank);
     }
             #endif
 }