private void OnCharacterLoaded(CallbackEventData data)
        {
            if (GetComponentInParent(data.GetData("Slot").GetType()) != (Component)data.GetData("Slot"))
            {
                return;
            }
            //StatRenderer renderer = GetComponentInParent<StatRenderer>();
            //if (renderer != null)
            //{
            string key = data.GetData("CharacterName") + ".StatSystem." + this.m_StatsHandler + "." + this.m_StatName;

            if (PlayerPrefs.HasKey(key + ".Value"))
            {
                float value = PlayerPrefs.GetFloat(key + ".Value");
                if (this.value != null)
                {
                    this.value.text = value.ToString();
                }
            }
            if (PlayerPrefs.HasKey(key + ".CurrentValue"))
            {
                float currentValue = PlayerPrefs.GetFloat(key + ".CurrentValue");
                if (this.currentValue != null)
                {
                    this.currentValue.text = currentValue.ToString();
                }
            }
            //}
        }
Esempio n. 2
0
        private void OnCharacterLoaded(CallbackEventData data)
        {
            if (GetComponentInParent(data.GetData("Slot").GetType()) != (Component)data.GetData("Slot"))
            {
                return;
            }

            string key = data.GetData("CharacterName") + ".Stats." + this.m_StatsHandler + "." + this.m_Stat.Name;

            if (PlayerPrefs.HasKey(key + ".Value"))
            {
                float value = PlayerPrefs.GetFloat(key + ".Value");
                if (this.m_Value != null)
                {
                    this.m_Value.text = value.ToString();
                }
            }
            if (PlayerPrefs.HasKey(key + ".CurrentValue"))
            {
                float currentValue = PlayerPrefs.GetFloat(key + ".CurrentValue");
                if (this.m_CurrentValue != null)
                {
                    this.m_CurrentValue.text = currentValue.ToString();
                }
            }
        }
        protected virtual void Use()
        {
            this.m_CharacterAnimator.CrossFadeInFixedTime(this.m_UseState, 0.15f);
            this.m_CharacterAnimator.Update(0f);
            CallbackEventData data = new CallbackEventData();

            data.AddData("Item", this.m_CurrentEquipedItem);
            Execute("OnUse", data);
        }
 protected void StopUse()
 {
     if (IsActive)
     {
         OnStopUse();
         this.m_InUse = false;
         this.m_CharacterAnimator.CrossFadeInFixedTime(this.m_IdleState, 0.15f);
         CallbackEventData data = new CallbackEventData();
         data.AddData("Item", this.m_CurrentEquipedItem);
         Execute("OnEndUse", data);
     }
 }
Esempio n. 5
0
 protected void Execute(string eventID, CallbackEventData eventData)
 {
     if (this.delegates != null)
     {
         int num   = 0;
         int count = this.delegates.Count;
         while (num < count)
         {
             CallbackHandler.Entry item = this.delegates[num];
             if (item.eventID == eventID && item.callback != null)
             {
                 item.callback.Invoke(eventData);
             }
             num++;
         }
     }
 }
Esempio n. 6
0
        public virtual void OnItemUnEquip(Item item)
        {
            this.m_CurrentEquipedItem = null;
            enabled = false;
            foreach (Attachment att in attachments)
            {
                if (att.gameObject != null)
                {
                    att.gameObject.SetActive(false);
                }
            }
            CallbackEventData data = new CallbackEventData();

            data.AddData("Item", item);
            data.AddData("Attachments", this.attachments);
            Execute("OnUnEquip", data);
        }
Esempio n. 7
0
        public virtual void OnItemEquip(Item item)
        {
            enabled = true;
            this.m_CurrentEquipedItem = item;
            foreach (Attachment att in this.attachments)
            {
                if (att.gameObject != null)
                {
                    att.gameObject.SetActive(true);
                }
                else
                {
                    att.Instantiate(this.m_Handler);
                }
            }
            CallbackEventData data = new CallbackEventData();

            data.AddData("Item", item);
            data.AddData("Attachments", this.attachments);
            Execute("OnEquip", data);
        }
        protected void ExecuteEvent <T>(ItemEventFunction <T> func, Item item, bool includeDisabled = false) where T : ITriggerEventHandler
        {
            for (int i = 0; i < this.m_TriggerEvents.Length; i++)
            {
                ITriggerEventHandler handler = this.m_TriggerEvents[i];
                if (ShouldSendEvent <T>(handler, includeDisabled))
                {
                    func.Invoke((T)handler, item, PlayerInfo.gameObject);
                }
            }

            string eventID = string.Empty;

            if (this.m_CallbackHandlers.TryGetValue(typeof(T), out eventID))
            {
                CallbackEventData triggerEventData = new CallbackEventData();
                triggerEventData.AddData("Trigger", this);
                triggerEventData.AddData("Player", PlayerInfo.gameObject);
                triggerEventData.AddData("EventData", new PointerEventData(EventSystem.current));
                triggerEventData.AddData("Item", item);
                base.Execute(eventID, triggerEventData);
            }
        }
Esempio n. 9
0
 private void OnRaiseEvent(CallbackEventData eventData)
 {
     raised = true;
 }
Esempio n. 10
0
 private void OnPasswordRecovered(CallbackEventData data)
 {
     messageBox.Open(LoginSystem.Settings.passwordRecovered, delegate(string result){messageBox.Close(); loginWindow.Open(); },"OK");
     Close ();
 }
Esempio n. 11
0
 private void OnFailedToRecoverPassword(CallbackEventData data)
 {
     messageBox.Open(LoginSystem.Settings.accountNotFound, delegate(string result){messageBox.Close(); Open(); },"OK");
     Close();
 }
Esempio n. 12
0
 private void OnFailedToLogin(CallbackEventData data)
 {
     if (LoginSystem.Settings.debug) {
         Debug.Log("[LoginSystem(UILogin)] Failed to login!");
     }
     messageBox.Open (LoginSystem.Settings.loginFailed, delegate(string result){messageBox.Close(); Open(); },"OK");
     Close();
 }
Esempio n. 13
0
        private void OnLogin(CallbackEventData data)
        {
            if (LoginSystem.Settings.debug) {
                Debug.Log("[LoginSystem(UILogin)] Login was successfull!");
            }
            if (rememberMe != null && rememberMe.isOn) {
                PlayerPrefs.SetString ("username", username.text);
                PlayerPrefs.SetString ("password", password.text);
            } else {
                PlayerPrefs.DeleteKey ("username");
                PlayerPrefs.DeleteKey ("password");
            }

            if (LoginSystem.Settings.loadLevelOnLogin ) {
                Application.LoadLevel(LoginSystem.Settings.levelToLoad);
            }
        }
Esempio n. 14
0
        private void OnFailedToCreateAccount(CallbackEventData data)
        {
            if (LoginSystem.Settings.debug) {
                Debug.Log("LoginSystem[UIRegistration]: Failed to create a new account!");
            }

            messageBox.Open (LoginSystem.Settings.userExists, delegate(string result){messageBox.Close(); Open(); },"OK");
            Close ();
        }
Esempio n. 15
0
        private void OnAccountCreated(CallbackEventData data)
        {
            if (LoginSystem.Settings.debug) {
                Debug.Log("LoginSystem[UIRegistration]: Account creation was successfull!");
            }

            messageBox.Open (LoginSystem.Settings.accountCreated, delegate(string result){messageBox.Close(); loginWindow.Open(); },"OK");
            Close ();
        }