Beispiel #1
0
 private void UpdateExecuteAndStopBtns()
 {
     if (!string.IsNullOrEmpty(GameManager.Instance.ExecutingAction) && CurrentAction.Data.Id == GameManager.Instance.ExecutingAction)
     {
         StopActionBtn.gameObject.SetActive(true);
         ExecuteActionBtn.gameObject.SetActive(false);
         ExecuteActionBtn.HideTooltip();
         if (CurrentAction.Metadata.Meta.Cancellable)
         {
             StopActionBtn.SetInteractivity(true);
         }
         else
         {
             StopActionBtn.SetInteractivity(false);
         }
     }
     else
     {
         StopActionBtn.gameObject.SetActive(false);
         ExecuteActionBtn.gameObject.SetActive(true);
         if (!string.IsNullOrEmpty(GameManager.Instance.ExecutingAction))
         {
             ExecuteActionBtn.SetInteractivity(false, "Another action runs already");
         }
         else
         {
             ExecuteActionBtn.SetInteractivity(true);
         }
     }
 }
Beispiel #2
0
 private async Task UpdateExecuteAndStopBtns()
 {
     try {
         await WebsocketManager.Instance.ExecuteAction(CurrentAction.Data.Id, true);
     } catch (RequestFailedException ex) {
         ExecuteActionBtn.SetInteractivity(false, ex.Message);
         return;
     }
     if (!string.IsNullOrEmpty(GameManager.Instance.ExecutingAction) && CurrentAction.Data.Id == GameManager.Instance.ExecutingAction)
     {
         StopActionBtn.gameObject.SetActive(true);
         ExecuteActionBtn.gameObject.SetActive(false);
         ExecuteActionBtn.HideTooltip();
         if (CurrentAction.Metadata.Meta.Cancellable)
         {
             StopActionBtn.SetInteractivity(true);
         }
         else
         {
             StopActionBtn.SetInteractivity(false);
         }
     }
     else
     {
         StopActionBtn.gameObject.SetActive(false);
         ExecuteActionBtn.gameObject.SetActive(true);
         if (!string.IsNullOrEmpty(GameManager.Instance.ExecutingAction))
         {
             ExecuteActionBtn.SetInteractivity(false, "Another action runs already");
         }
         else
         {
             ExecuteActionBtn.SetInteractivity(true);
         }
     }
 }