コード例 #1
0
ファイル: ActionMenu.cs プロジェクト: ZdenekM/arcor2_editor
 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);
         }
     }
 }
コード例 #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);
         }
     }
 }