Beispiel #1
0
 public override void onAddCallBack <T>(T data)
 {
     if (data is UIData)
     {
         UIData uiData = data as UIData;
         {
             uiData.toastData.allAddCallBack(this);
             uiData.toastMessageUI.allAddCallBack(this);
         }
         dirty = true;
         return;
     }
     if (data is ToastData)
     {
         ToastData toastData = data as ToastData;
         {
             ToastDataUpdate toastDataUpdate = this.GetComponent <ToastDataUpdate>();
             if (toastDataUpdate != null)
             {
                 toastDataUpdate.setData(toastData);
             }
             else
             {
                 Debug.LogError("toastDataUpdate null");
             }
         }
         dirty = true;
         return;
     }
     if (data is ToastMessageUI.UIData)
     {
         ToastMessageUI.UIData subUIData = data as ToastMessageUI.UIData;
         {
             if (toastMessageUI != null)
             {
                 toastMessageUI.setData(subUIData);
             }
             else
             {
                 Debug.LogError("toastMessageUI null");
             }
         }
         dirty = true;
         return;
     }
     Debug.LogError("Don't process: " + data + "; " + this);
 }
Beispiel #2
0
 public override void refresh()
 {
     if (dirty)
     {
         dirty = false;
         if (this.data != null)
         {
             // Find current show toastMessage
             ToastMessage currentMessage = null;
             {
                 if (this.data.toastData.v != null)
                 {
                     ToastData toastData = this.data.toastData.v;
                     if (toastData.state.v == ToastData.State.Normal)
                     {
                         if (toastData.messages.vs.Count > 0)
                         {
                             currentMessage = toastData.messages.vs[0];
                         }
                         else
                         {
                             Logger.Log("Don't have any message");
                         }
                     }
                 }
                 else
                 {
                     Logger.LogError("toastData null");
                 }
             }
             // Show
             {
                 if (this.data.toastMessageUI.v != null)
                 {
                     ToastMessageUI.UIData toastMessageUI = this.data.toastMessageUI.v;
                     toastMessageUI.toastMessage.v = new ReferenceData <ToastMessage>(currentMessage);
                 }
             }
         }
         else
         {
             Debug.LogError("data null");
         }
     }
 }
Beispiel #3
0
 public override void onRemoveCallBack <T>(T data, bool isHide)
 {
     if (data is UIData)
     {
         UIData uiData = data as UIData;
         {
             uiData.toastData.allRemoveCallBack(this);
             uiData.toastMessageUI.allRemoveCallBack(this);
         }
         this.setDataNull(uiData);
         return;
     }
     if (data is ToastData)
     {
         ToastData toastData = data as ToastData;
         {
             ToastDataUpdate toastDataUpdate = this.GetComponent <ToastDataUpdate>();
             if (toastDataUpdate != null)
             {
                 if (toastDataUpdate.data == toastData)
                 {
                     toastDataUpdate.setData(null);
                 }
                 else
                 {
                     Debug.LogError("why different");
                 }
             }
             else
             {
                 Debug.LogError("toastDataUpdate null");
             }
         }
         return;
     }
     if (data is ToastMessageUI.UIData)
     {
         ToastMessageUI.UIData subUIData = data as ToastMessageUI.UIData;
         {
             if (toastMessageUI != null)
             {
                 if (toastMessageUI.data == subUIData)
                 {
                     toastMessageUI.setData(null);
                 }
                 else
                 {
                     Debug.LogError("why different");
                 }
             }
             else
             {
                 Debug.LogError("toastMessageUI null");
             }
         }
         // Remove child
         {
             if (subUIData.toastMessage.v.data != null)
             {
                 subUIData.toastMessage.v = new ReferenceData <ToastMessage>(null);
             }
         }
         return;
     }
     Debug.LogError("Don't process: " + data + "; " + this);
 }