Beispiel #1
0
 public void updateChatters(List <string> c)
 {
     if (this.output_text.InvokeRequired)
     {
         UpdateCallBack d = new UpdateCallBack(updateChatters);
         this.Invoke(d, new object[] { c });
     }
     else
     {
         chatters.Text = "";
         foreach (string s in c)
         {
             chatters.Text += s + "\r\n";
         }
     }
 }
Beispiel #2
0
    IEnumerator UpdateProfile()
    {
        AppManager.Instance.loading.SetActive(true);
        signupApi.user_name  = name.text;
        signupApi.user_pwd   = password.text;
        signupApi.user_email = email.text;

        string infoText = JsonUtility.ToJson(signupApi).ToString();

        WWWForm form = new WWWForm();

        form.AddField("uid", AppManager.Instance.phoneNumber);
        form.AddField("info", infoText);

        using (UnityWebRequest www = UnityWebRequest.Post("http://39.107.240.174/api/addict/update?appid=addict&access_token=0000&sign=12345&uid=", form))
        {
            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
                AppManager.Instance.loading.SetActive(false);
            }
            else
            {
                string         responseText = www.downloadHandler.text;
                UpdateCallBack callback     = new UpdateCallBack();
                callback = JsonUtility.FromJson <UpdateCallBack>(responseText);

                if (callback.errmsg == "OK")
                {
                    invalidText.text = "";
                    AppManager.Instance.FetchUserData();
                    AppManager.Instance.loading.SetActive(false);
                    ScreenManager.Instance.Activate <HomeScreen>();
                }
                else if (callback.errmsg == "wrong username or userpwd")
                {
                    AppManager.Instance.loading.SetActive(false);
                    invalidText.text = "Invalid Username or Password!";
                }
            }
        }
    }
Beispiel #3
0
 public void UpdateWcDayComment(string comment, UpdateCallBack udpCallBack)
 {
     if (_dayComment != null && _dayComment == comment) return;
     _dayComment = comment;
     if(udpCallBack!=null) udpCallBack.Invoke();
 }
Beispiel #4
0
 public void UpdateWcDayAttr(WсDayAttr dayAttr, UpdateCallBack udpCallBack)
 {
     if (Equals(dayAttr, _dayAttr)) return;
     _dayAttr = dayAttr;
     if (udpCallBack != null) udpCallBack.Invoke();
 }
 public void SetLabel(string label)
 {
     if (TreeView != null && TreeView.InvokeRequired) {
     UpdateCallBack d = new UpdateCallBack(SetLabel);
     TreeView.Invoke(d, new object[] { label });
       } else {
     Text = label;
       }
 }
Beispiel #6
0
        static void ScrollChooser(
            ref int answer, ref int intFrom,
            CardChoiseContext choise,
            ConsoleWindowText collectionWindow,
            ConsoleWindowText descriptionWindow,
            ConsoleKey exit,
            ConsoleKey use,
            UpdateCallBack redraw,
            CallBack onUseItem)
        {
            ConsoleKey pressed = ConsoleKey.NoName;

            do
            {
                pressed = Console.ReadKey().Key;
                // . . . . navigating in list
                List <int> needRedraw = new List <int>();
                if (pressed == ConsoleKey.DownArrow || pressed == ConsoleKey.UpArrow)
                {
                    int offset = pressed == ConsoleKey.DownArrow ? 1 : -1;
                    answer += offset;
                    if (answer < 0)
                    {
                        answer = choise.OptionsCount - 1;
                    }
                    if (answer > choise.OptionsCount - 1)
                    {
                        answer = 0;
                    }

                    if (answer < intFrom)
                    {
                        intFrom = answer;
                    }
                    if (answer > intFrom + collectionWindow.Heigth - 1)
                    {
                        intFrom = answer - collectionWindow.Heigth + 1;
                    }

                    for (int i = 0; i < Math.Min(collectionWindow.Heigth, choise.OptionsCount); ++i)
                    {
                        needRedraw.Add(intFrom + i);
                    }
                }
                if (needRedraw.Count > 0)
                {
                    choise.HighlightSelected(answer);
                    if (!choise.PreviewSelected(answer, descriptionWindow))
                    {
                        descriptionWindow.ClearLogWindow();
                        descriptionWindow.AddLog(choise.DescriptionForOption(answer));
                    }
                }
                redraw(needRedraw, choise.ChoiseOptions, answer, intFrom, collectionWindow, true);
                //
                if (pressed == use)
                {
                    onUseItem();
                }
            } while (pressed != exit);
        }