예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (fpsController.enabled)
        {
            EquipSystem equipSystem = GetComponent <EquipSystem>();
            if (CrossPlatformInputManager.GetButtonDown("Interact") && itemInView != null)
            {
                //Interacting with objects in the world
                itemInView.GetComponent <InteractableBase>().OnInteract();
            }
            else if (equipSystem && equipSystem.currentEquippedItem)
            {
                Pickupable pickupable = equipSystem.currentEquippedItem.GetComponent <Pickupable>();
                if (pickupable)
                {
                    //Using item that the player has equipped
                    if (CrossPlatformInputManager.GetButtonDown("Fire1"))
                    {
                        pickupable.OnUse();
                        UseItem?.Invoke(pickupable);
                    }
                    else if (CrossPlatformInputManager.GetButtonDown("DropItem"))
                    {
                        equipSystem.DropItem(pickupable.item);
                    }
                }
            }
        }

        if (CrossPlatformInputManager.GetButtonDown("Cancel"))
        {
            CancelAction?.Invoke();
        }
    }
예제 #2
0
        public static void Initialize()
        {
            Page = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);

            Page.AddLabel("Title", new Action <GameObject>((obj) => { titleObject = obj; }));
            Page.AddLabel("Waiting for key...", new Action <GameObject>((obj) => { textObject = obj; }));

            Page.AddSimpleButton("Clear", new Action(() =>
            {
                selectedKeys.Clear();
            }));

            Page.AddSimpleButton("Accept", new Action(() =>
            {
                AcceptAction?.Invoke(selectedKeys);
                fetchingKeys = false;
                Page.Hide();
            }));

            Page.AddSimpleButton("Cancel", new Action(() =>
            {
                CancelAction?.Invoke();
                fetchingKeys = false;
                Page.Hide();
            }));
        }
 void OnCancelButtonClicked()
 {
     // Helpmode
     if (HelpDialogController.SetHelpID(SetHelpModeIDAction.HelpModeEntryID.Cancel))
     {
         return;
     }
     Dispatcher.Dispatch(CancelAction.From(true));
 }
예제 #4
0
        public Pipe(RequestKey Key, PipingOptions Options)
        {
            const string Options_WaitingTimeout = nameof(Options) + "." + nameof(Options.WaitingTimeout);

            this.Key     = Key;
            this.Options = Options;
            if (Options.WaitingTimeout < TimeSpan.Zero)
            {
                throw new ArgumentException(string.Format(NameIsValue1RequiredNameIsValue2Over, Options_WaitingTimeout, Options.WaitingTimeout, nameof(TimeSpan.Zero)));
            }
            if (Options.WaitingTimeout is TimeSpan WaitTimeout)
            {
                WaitTokenSource = new CancellationTokenSource(WaitTimeout);
                var Token = WaitTokenSource.Token;
                CancelAction = WaitTokenSource.Token.Register(() =>
                {
                    ReadyTaskSource.TrySetCanceled(Token);
                    ResponseTaskSource.TrySetCanceled(Token);
                });
                ReadyTaskSource.Task.ContinueWith(t => CancelAction?.Dispose());
            }
            RegisterEvents();
        }
예제 #5
0
        public static CancelableFuture <T> Create <T>(Func <OperationContext, T> del, CancelAction action, ProgressTrackerFactory factory)
        {
            CancelableFuture <T> cf = new CancelableFuture <T>(del, action, factory);

            cf.RunInThreadPool();
            return(cf);
        }
예제 #6
0
 public static CancelableFuture <T> Create <T>(Func <OperationContext, T> del, CancelAction action)
 {
     return(Create(del, action, ProgressTrackerFactory.Default));
 }
예제 #7
0
        IEnumerator AcknowledgeCancel()
        {
            yield return(new WaitForSeconds(0));

            Dispatcher.Dispatch(CancelAction.From(false));
        }
예제 #8
0
 private void Cancel()
 {
     StepViewModel.CancelAction?.Invoke();
     CancelAction?.Invoke();
 }
예제 #9
0
 public void InitInterface()
 {
     CutInterface();
     m_cancelAction = ScriptableObject.CreateInstance<CancelAction>();
     m_cancelAction.Init(this, 0);
     m_homePortal=ScriptableObject.CreateInstance<HomePortal>();
     m_homePortal.Init(this,1);
     m_stayButton=ScriptableObject.CreateInstance<StayButton>();
     m_stayButton.Init(this,2);
     MineController = ScriptableObject.CreateInstance<MineController>();
     MineController.Init(this);
 }
예제 #10
0
 public void OnTransitionCancel(Transition p0)
 {
     CancelAction?.Invoke();
 }
예제 #11
0
 internal EmptyCancelableFuture(Action <OperationContext> del, CancelAction action, ProgressTrackerFactory factory)
     : base(action, factory)
 {
     m_futureDel = del;
 }
예제 #12
0
 /// <summary>
 /// Cancels this instance.
 /// </summary>
 public void Cancel()
 {
     Close();
     CancelAction?.Invoke();
 }
예제 #13
0
 public void Cancel()
 {
     MainViewModel.HidePopup();
     CancelAction.Invoke();
 }
예제 #14
0
 private void Cancel()
 {
     CancelAction?.Invoke();
 }
예제 #15
0
 public static CancelableFuture CreateNoRun(Action <OperationContext> callback, CancelAction action, ProgressTrackerFactory factory)
 {
     return(new EmptyCancelableFuture(callback, action, factory));
 }
예제 #16
0
 public static CancelableFuture <T> CreateNoRun <T>(Func <OperationContext, T> del, CancelAction action, ProgressTrackerFactory factory)
 {
     return(new CancelableFuture <T>(del, action, factory));
 }
예제 #17
0
 /// <summary>
 /// 取消
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     CancelAction?.Invoke();
 }
예제 #18
0
 protected CancelableFuture(CancelAction action, ProgressTrackerFactory factory)
 {
     m_cancelAction = action;
     m_proxy        = new ProgressTrackerProxy(this, factory);
     m_opContext    = new OperationContext(m_proxy);
 }
예제 #19
0
 public void CancelClicked()
 {
     CancelAction?.Invoke();
 }