示例#1
0
        /// <summary>
        /// Use this to enable and disable the button.
        /// </summary>
        /// <param name="act"></param>
        public virtual void SetInteractable(bool act, bool fromSelection)
        {
            mInteractable = act;

            /* Make sure no error! */
            {
                if (mButton == null)
                {
                    InitJCSButton();
                }
            }
            mButton.enabled = mInteractable;

            if (mInteractable)
            {
                mImage.color = mInteractColor;
            }
            else
            {
                mImage.color = mNotInteractColor;
            }

            if (!fromSelection && mButtonSelection != null)
            {
                mButtonSelection.SetSkip(!mInteractable, true);
            }

            // interactable callback.
            if (interactableCallback != null)
            {
                interactableCallback.Invoke();
            }
        }
示例#2
0
        /// <summary>
        /// Default function to call this, so we dont have to
        /// search the function depends on name.
        ///
        /// * Good for organize code and game data file in Unity.
        /// </summary>
        public virtual void JCS_ButtonClick()
        {
            if (!mInteractable)
            {
                return;
            }

            /* System callback */
            if (btnSystemCallBack != null)
            {
                btnSystemCallBack.Invoke();
            }

            if (btnSystemCallBackBtn != null)
            {
                btnSystemCallBackBtn.Invoke(this);
            }

            if (btnSystemCallBackBtnInt != null)
            {
                btnSystemCallBackBtnInt.Invoke(this.mDialogueSelection);
            }

            /* User callback */
            if (btnCallBack != null)
            {
                btnCallBack.Invoke();
            }

            if (btnCallBackBtn != null)
            {
                btnCallBackBtn.Invoke(this);
            }
        }
示例#3
0
 public override void  CallBack(object o)
 {
     ClientManager.EnterCriticalArea();
     if (Func != null)
     {
         Func.Invoke(client);
     }
     ClientManager.LeaveCriticalArea();
 }
示例#4
0
 public void ToAddMessagesLabel(UsCtrlExInfors lmp, CallBackFunc CallBack)
 {
     if (lmp.LayerType == ScreenShotCutLib.Enums.EnLayerType.Label)
     {
         if (string.IsNullOrEmpty(lmp.ControlName?.Trim()))
         {
             AddMessagesCallBack = CallBack;
             CtrlExInfor         = lmp;
             Switcher.IsAddingOrEditingMessageLabel = true;
         }
         else
         {
             AddMessagesLable(lmp as UsLabelExInfors);
             CallBack?.Invoke();
         }
     }
     else
     {
         CallBack?.Invoke();
     }
 }
示例#5
0
 private void UCtrlBackGround_MouseDown(object sender, MouseEventArgs e)
 {
     if (Switcher.IsAddingOrEditingMessageLabel)
     {
         if (e.Button == MouseButtons.Left)
         {
             if (CtrlExInfor.LayerType == ScreenShotCutLib.Enums.EnLayerType.Label)
             {
                 var lblExInfor = CtrlExInfor as UsLabelExInfors;
                 lblExInfor.LblParams.Location = e.Location;
                 AddMessagesLable(lblExInfor);
                 Switcher.IsAddingOrEditingMessageLabel = false;
                 AddMessagesCallBack?.Invoke();
             }
         }
         else if (e.Button == MouseButtons.Right)
         {
             Switcher.IsAddingOrEditingMessageLabel = false;
             AddMessagesCallBack?.Invoke();
         }
     }
 }