//--------------------------------------------------------------------------------
        // onClickForgotPassword
        //--------------------------------------------------------------------------------
        public void onClickForgotPassword()
        {
            if (inputUsername != null &&
                inputEmail != null)
            {
                if (LoomClient.validateName(inputUsername.text) ||
                    LoomClient.validateEmail(inputEmail.text)
                    )
                {
                    string[] fields = new string[] { inputUsername.text, inputEmail.text };

                    TemporaryDisable(buttonForgot);

                    LoomClient.ActionForgotPassword(fields, onCallbackForgotPassword);
                }
                else
                {
                    FindObjectOfType <LC_UIPanelMessage>().Show(LoomClient.LANG_ERROR);
                }
            }
            else
            {
                Debug.LogWarning(LoomClient.LANG_EDITOR_MISSING + this.name);
            }
        }
        //--------------------------------------------------------------------------------
        // onClickChangePassword
        //--------------------------------------------------------------------------------
        public void onClickChangePassword()
        {
            if (inputPasswordOld != null &&
                inputPassword != null &&
                inputPasswordRepeat != null)
            {
                if (LoomClient.validatePassword(inputPasswordOld.text) &&
                    LoomClient.validatePassword(inputPassword.text) &&
                    LoomClient.validatePassword(inputPasswordRepeat.text) &&
                    inputPasswordOld.text != inputPassword.text
                    )
                {
                    string[] fields = new string[] { inputPasswordOld.text, inputPassword.text };

                    TemporaryDisable(buttonChange);

                    LoomClient.ActionChangeAccountPassword(fields, onCallbackChangePassword);
                }
                else
                {
                    FindObjectOfType <LC_UIPanelMessage>().Show(LoomClient.LANG_ERROR);
                }
            }
            else
            {
                Debug.LogWarning(LoomClient.LANG_EDITOR_MISSING + this.name);
            }
        }
Beispiel #3
0
        //--------------------------------------------------------------------------------
        // onClickLogin
        //--------------------------------------------------------------------------------
        public void onClickLogin()
        {
            if (inputUsername != null &&
                inputPassword != null
                )
            {
                if (LoomClient.validateName(inputUsername.text) &&
                    LoomClient.validatePassword(inputPassword.text))
                {
                    string[] fields = new string[] { inputUsername.text, inputPassword.text, LoomClient.AppId };

                    TemporaryDisable(buttonLogin);

                    LoomClient.ActionLogin(fields, onCallbackLogin);
                }
                else
                {
                    FindObjectOfType <LC_UIPanelMessage>().Show(LoomClient.LANG_ERROR);
                }
            }
            else
            {
                Debug.LogWarning(LoomClient.LANG_EDITOR_MISSING + this.name);
            }
        }
Beispiel #4
0
 // -------------------------------------------------------------------------------
 // GetInstance (Singleton)
 // -------------------------------------------------------------------------------
 public static LoomClient GetInstance()
 {
     if (!_instance)
     {
         GameObject client = new GameObject("LoomClient");
         _instance = client.AddComponent <LoomClient>();
     }
     return(_instance);
 }
 //--------------------------------------------------------------------------------
 // onCheckVersion
 //--------------------------------------------------------------------------------
 private void onCheckVersion()
 {
     if (text != null)
     {
         LoomClient.ActionCheckVersion(new string[] { LoomClient.AppId, LoomClient.LOOM_VERSION }, onCallbackCheckVersion);
     }
     else
     {
         Debug.LogWarning(LoomClient.LANG_EDITOR_MISSING + this.name);
     }
 }
Beispiel #6
0
 //--------------------------------------------------------------------------------
 // onCallbackLogin
 //--------------------------------------------------------------------------------
 private void onCallbackLogin(string[] result)
 {
     if (result[0] == "1")
     {
         LoomClient.Login(result);
         Hide();
     }
     else
     {
         FindObjectOfType <LC_UIPanelMessage>().Show(LoomClient.LANG_LOGIN_FAIL);
     }
 }
Beispiel #7
0
 //--------------------------------------------------------------------------------
 // onClickLogout
 //--------------------------------------------------------------------------------
 public void onClickLogout()
 {
     if (buttonLogout != null)
     {
         TemporaryDisable(buttonLogout);
         LoomClient.Logout();
     }
     else
     {
         Debug.LogWarning(LoomClient.LANG_EDITOR_MISSING + this.name);
     }
 }
Beispiel #8
0
 //--------------------------------------------------------------------------------
 // onCallbackDeleteAccount
 //--------------------------------------------------------------------------------
 private void onCallbackDeleteAccount(string[] result)
 {
     if (result[0] == "1")
     {
         Hide();
         FindObjectOfType <LC_UIPanelMessage>().Show(LoomClient.LANG_DELETE_CONFIRM);
         LoomClient.Logout();
     }
     else
     {
         FindObjectOfType <LC_UIPanelMessage>().Show(LoomClient.LANG_DELETE_FAIL);
     }
 }
 //--------------------------------------------------------------------------------
 // onClickSell
 //--------------------------------------------------------------------------------
 public void onClickSell()
 {
     if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualCurrency)
     {
         string[] fields = new string[] { objectId.ToString(), sliderAmount.value.ToString() };
         TemporaryDisable(buttonSell);
         LoomClient.ActionSellCurrency(fields, onCallbackSell);
     }
     else if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualGood)
     {
     }
     else if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualProperty)
     {
     }
 }
Beispiel #10
0
 //--------------------------------------------------------------------------------
 // OnInvokeRepeating
 //--------------------------------------------------------------------------------
 public override void OnInvokeRepeating()
 {
     if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualCurrency)
     {
         LoomClient.ActionGetCurrencies(onCallbackGetCurrencies);
     }
     else if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualGood)
     {
         LoomClient.ActionGetGoods(onCallbackGetGoods);
     }
     else if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualProperty)
     {
         LoomClient.ActionGetProperties(onCallbackGetProperties);
     }
     else if (objectType == LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualEntity)
     {
         LoomClient.ActionGetEntities(onCallbackGetEntities);
     }
 }
Beispiel #11
0
        //--------------------------------------------------------------------------------
        // onClickDeleteAccount
        //--------------------------------------------------------------------------------
        public void onClickDeleteAccount()
        {
            if (inputUsername != null &&
                inputPassword != null)
            {
                if (LoomClient.validateName(inputUsername.text) &&
                    LoomClient.validatePassword(inputPassword.text)
                    )
                {
                    string[] fields = new string[] { inputUsername.text, inputPassword.text };

                    TemporaryDisable(buttonDelete);

                    LoomClient.ActionDeleteAccount(fields, onCallbackDeleteAccount);
                }
            }
            else
            {
                Debug.LogWarning(LoomClient.LANG_EDITOR_MISSING + this.name);
            }
        }
Beispiel #12
0
 // -------------------------------------------------------------------------------
 // resetClient
 // -------------------------------------------------------------------------------
 private static void resetClient()
 {
     _instance     = null;
     AccountOnline = false;
 }
 //--------------------------------------------------------------------------------
 // ActionForgotPassword
 //--------------------------------------------------------------------------------
 public static void ActionForgotPassword(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(1, 2, fields, callbackFunction);
 }
Beispiel #14
0
        // ===============================================================================
        // UNITY RELATED FUNCTIONS
        // ===============================================================================

        // -------------------------------------------------------------------------------
        // OnApplicationQuit
        // -------------------------------------------------------------------------------
        void OnApplicationQuit()
        {
            LoomClient.Logout();
        }
Beispiel #15
0
 // -------------------------------------------------------------------------------
 // Logout
 // -------------------------------------------------------------------------------
 public static void Logout()
 {
     LoomClient.ActionLogout(onCallbackLogout);
 }
 //--------------------------------------------------------------------------------
 // ActionLogin
 //--------------------------------------------------------------------------------
 public static void ActionLogin(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(1, 3, fields, callbackFunction);
 }
 //--------------------------------------------------------------------------------
 // ActionRegisterAccount
 //--------------------------------------------------------------------------------
 public static void ActionRegisterAccount(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(1, 5, fields, callbackFunction);
 }
Beispiel #18
0
 //--------------------------------------------------------------------------------
 // onClickTabGoods
 //--------------------------------------------------------------------------------
 public void onClickTabGoods()
 {
     objectType = LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualGood;
     LoomClient.ActionGetGoods(onCallbackGetGoods);
 }
 //--------------------------------------------------------------------------------
 // ActionDeleteAccount
 //--------------------------------------------------------------------------------
 public static void ActionDeleteAccount(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(2, 7, fields, callbackFunction);
 }
 //--------------------------------------------------------------------------------
 // ActionChangeAccountPassword
 //--------------------------------------------------------------------------------
 public static void ActionChangeAccountPassword(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(2, 6, fields, callbackFunction);
 }
 //--------------------------------------------------------------------------------
 // ActionResendConfirmation
 //--------------------------------------------------------------------------------
 public static void ActionResendConfirmation(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(1, 6, fields, callbackFunction);
 }
 //--------------------------------------------------------------------------------
 // ActionSellEntity
 //--------------------------------------------------------------------------------
 public static void ActionSellEntity(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(7, 2, fields, callbackFunction);
 }
Beispiel #23
0
        // ===============================================================================
        // TAB BUTTON FUNCTIONS
        // ===============================================================================

        //--------------------------------------------------------------------------------
        // onClickTabCurrencies
        //--------------------------------------------------------------------------------
        public void onClickTabCurrencies()
        {
            objectType = LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualCurrency;
            LoomClient.ActionGetCurrencies(onCallbackGetCurrencies);
        }
 //--------------------------------------------------------------------------------
 // ActionLogout
 //--------------------------------------------------------------------------------
 public static void ActionLogout(Action <string[]> callbackFunction)
 {
     LoomClient.SendData(1, 4, new string[] {}, callbackFunction, true);
 }
Beispiel #25
0
 //--------------------------------------------------------------------------------
 // onClickTabProperties
 //--------------------------------------------------------------------------------
 public void onClickTabProperties()
 {
     objectType = LoomClient.LOOM_ENUM_VIRTUAL_OBJ_TYPE.virtualProperty;
     LoomClient.ActionGetProperties(onCallbackGetProperties);
 }
        // -------------------------------------------------------------------------------
        // SendData
        // -------------------------------------------------------------------------------
        public static void SendData(int categoryId, int actionId, string[] fields, Action <string[]> callbackFunction, bool runSilent = false)
        {
            LoomClient instance = GetInstance();

            instance.StartCoroutine(instance.WebRequestSend(categoryId, actionId, fields, callbackFunction, runSilent));
        }
        //================================================================================
        // CLIENT
        //================================================================================

        //--------------------------------------------------------------------------------
        // ActionCheckVersion
        //--------------------------------------------------------------------------------
        public static void ActionCheckVersion(string[] fields, Action <string[]> callbackFunction)
        {
            LoomClient.SendData(1, 0, fields, callbackFunction);
        }
        //================================================================================
        // ENTITIES
        //================================================================================

        //--------------------------------------------------------------------------------
        // ActionGetEntities
        //--------------------------------------------------------------------------------
        public static void ActionGetEntities(Action <string[]> callbackFunction)
        {
            LoomClient.SendData(7, 0, new string[] {}, callbackFunction);
        }
 //--------------------------------------------------------------------------------
 // Show
 //--------------------------------------------------------------------------------
 public override void OnChildEnable()
 {
     LoomClient.GetInstance();
     text.text = LoomClient.LANG_CHECK_VERSION;
     onCheckVersion();
 }
 //--------------------------------------------------------------------------------
 // ActionBuyProperty
 //--------------------------------------------------------------------------------
 public static void ActionBuyProperty(string[] fields, Action <string[]> callbackFunction)
 {
     LoomClient.SendData(6, 1, fields, callbackFunction);
 }