コード例 #1
0
ファイル: HideUpdate.cs プロジェクト: VietTho1989/Toast
 public override void Update()
 {
     base.Update();
     if (dirty)
     {
         dirty = false;
         if (this.data != null)
         {
             ToastMessageUI.UIData toastMessageUIData = this.data.findDataInParent <ToastMessageUI.UIData>();
             if (toastMessageUIData != null)
             {
                 ToastMessageUI toastMessageUI = toastMessageUIData.findCallBack <ToastMessageUI>();
                 if (toastMessageUI != null)
                 {
                     // parent position to hide
                     {
                         // toastMessageUI.transform.localPosition = ToastMessageUI.HidePos;
                         ToastMessageUI.HideRect.set((RectTransform)toastMessageUI.transform);
                     }
                     // check current toast message
                     {
                         if (this.data.toastMessage.v.data != null)
                         {
                             // update UI
                             {
                                 if (toastMessageUI.tvMessage != null)
                                 {
                                     toastMessageUI.tvMessage.text = this.data.toastMessage.v.data.message.v;
                                 }
                                 else
                                 {
                                     Logger.LogError("toastMessageUI null");
                                 }
                             }
                             // change to appear
                             {
                                 Appear appear = new Appear();
                                 {
                                     appear.uid            = toastMessageUIData.state.makeId();
                                     appear.toastMessage.v = new ReferenceData <ToastMessage>(this.data.toastMessage.v.data);
                                 }
                                 toastMessageUIData.state.v = appear;
                             }
                         }
                         else
                         {
                             if (toastMessageUIData.toastMessage.v.data != null)
                             {
                                 // update UI
                                 {
                                     if (toastMessageUI.tvMessage != null)
                                     {
                                         toastMessageUI.tvMessage.text = toastMessageUIData.toastMessage.v.data.message.v;
                                     }
                                     else
                                     {
                                         Logger.LogError("toastMessageUI null");
                                     }
                                 }
                                 this.data.toastMessage.v = new ReferenceData <ToastMessage>(toastMessageUIData.toastMessage.v.data);
                             }
                         }
                     }
                     // wrap content
                     {
                         if (toastMessageUI.toastMessageContainer != null)
                         {
                             toastMessageUI.toastMessageContainer.enabled = false;
                             toastMessageUI.toastMessageContainer.enabled = true;
                         }
                         else
                         {
                             Logger.LogError("toastMessageContainer null");
                         }
                     }
                 }
                 else
                 {
                     Logger.LogError("toastMessageUI null");
                 }
             }
             else
             {
                 Logger.LogError("toastMessageUIData null");
             }
         }
         else
         {
             Logger.LogError("data null");
         }
     }
 }
コード例 #2
0
ファイル: DisappearUpdate.cs プロジェクト: VietTho1989/Toast
 public override void Update()
 {
     base.Update();
     if (dirty)
     {
         dirty = false;
         if (this.data != null)
         {
             ToastMessageUI.UIData toastMessageUIData = this.data.findDataInParent <ToastMessageUI.UIData>();
             if (toastMessageUIData != null)
             {
                 ToastMessageUI toastMessageUI = toastMessageUIData.findCallBack <ToastMessageUI>();
                 if (toastMessageUI != null)
                 {
                     // UI
                     {
                         ToastMessageUI.ShowRect.set((RectTransform)toastMessageUI.transform);
                         // tvMessage
                         {
                             if (toastMessageUI.tvMessage != null)
                             {
                                 ToastMessage toastMessage = this.data.toastMessage.v.data;
                                 if (toastMessage != null)
                                 {
                                     toastMessageUI.tvMessage.text = toastMessage.message.v;
                                 }
                                 else
                                 {
                                     Logger.LogError("toastMessage null");
                                 }
                             }
                             else
                             {
                                 Logger.LogError("tvMessage null");
                             }
                         }
                     }
                     // change to hide
                     {
                         Hide hide = new Hide();
                         {
                             hide.uid = toastMessageUIData.state.makeId();
                         }
                         toastMessageUIData.state.v = hide;
                     }
                 }
                 else
                 {
                     Logger.LogError("toastMessageUI null");
                 }
             }
             else
             {
                 Logger.LogError("toastMessageUIData null");
             }
         }
         else
         {
             Logger.LogError("data null");
         }
     }
 }
コード例 #3
0
 public override void Update()
 {
     base.Update();
     if (dirty)
     {
         dirty = false;
         if (this.data != null)
         {
             ToastMessageUI.UIData toastMessageUIData = this.data.findDataInParent <ToastMessageUI.UIData>();
             if (toastMessageUIData != null)
             {
                 ToastMessageUI toastMessageUI = toastMessageUIData.findCallBack <ToastMessageUI>();
                 if (toastMessageUI != null)
                 {
                     // UI
                     {
                         ToastMessageUI.ShowRect.set((RectTransform)toastMessageUI.transform);
                         // tvMessage
                         {
                             if (toastMessageUI.tvMessage != null)
                             {
                                 ToastMessage toastMessage = this.data.toastMessage.v.data;
                                 if (toastMessage != null)
                                 {
                                     toastMessageUI.tvMessage.text = toastMessage.message.v;
                                 }
                                 else
                                 {
                                     Logger.LogError("toastMessage null");
                                 }
                             }
                             else
                             {
                                 Logger.LogError("tvMessage null");
                             }
                         }
                     }
                     // change to disappear
                     {
                         if (this.data.toastMessage.v.data != toastMessageUIData.toastMessage.v.data)
                         {
                             Disappear disappear = new Disappear();
                             {
                                 disappear.uid            = toastMessageUIData.state.makeId();
                                 disappear.toastMessage.v = new ReferenceData <ToastMessage>(this.data.toastMessage.v.data);
                             }
                             toastMessageUIData.state.v = disappear;
                         }
                         else
                         {
                             Logger.Log("not different, don't need to change");
                         }
                     }
                 }
                 else
                 {
                     Logger.LogError("toastMessageUI null");
                 }
             }
             else
             {
                 Logger.LogError("toastMessageUIData null");
             }
         }
         else
         {
             Logger.LogError("data null");
         }
     }
 }