Example #1
0
        // Change the certain Thumbnail button's visible and enable status
        // based on the current selected index in the imageListView
        private void ChangeVisibility(ThumbnailToolbarButton btn,
                                      bool show, ButtonTask task)
        {
            if (btn != null)
            {
                // Update the button's UI status
                btn.Visible       = show;
                btn.IsInteractive = show;

                // Change the certain button enable status based on the
                // selected index of the imageListView
                switch (task)
                {
                case ButtonTask.First:
                case ButtonTask.Previous:
                    // The First and Previous Thumbnail toolbar button
                    // is enabled if the first image in the
                    // imageListView is not selected
                    btn.Enabled = !imageListView.Items[0].Selected;
                    break;

                case ButtonTask.Last:
                case ButtonTask.Next:
                    // The Last and Next Thumbnail toolbar button
                    // is enabled if the last image in the
                    // imageListView is not selected
                    btn.Enabled = !imageListView.Items[imageListView.
                                                       Items.Count - 1].Selected;
                    break;
                }
            }
        }
Example #2
0
    public override void updateItem(GameObject item, int index)
    {
        //base.updateItem (item, index);

        ButtonTask button = item.GetComponent <ButtonTask> ();

        button.updateTask(tasks [index]);
    }
Example #3
0
 // Start is called before the first frame update
 private void Start()
 {
     skyJumpNum  = 0;
     rBody       = GetComponent <Rigidbody2D>();
     boxCol      = GetComponent <BoxCollider2D>();
     buttonTask  = Utility.GetButton();
     cameraTask  = Utility.GetCamera();
     swordPrefab = Resources.Load <GameObject>(GetPath.GamePrefab + "/Sword");
     jumpEffect  = Resources.Load <GameObject>(GetPath.GamePrefab + "/JumpEffect");
 }
Example #4
0
    public override void initButton(int i)
    {
        if (nodeList [i] == null)
        {
            nodeList [i] = NGUITools.AddChild(gameObject, (fatherWindow as TaskWindow).taskitem);
        }

        nodeList [i].name = StringKit.intToFixString(i + 1);
        ButtonTask button = nodeList [i].GetComponent <ButtonTask> ();

        button.fatherWindow = fatherWindow;
        button.initialize(tasks [i]);
    }
        public static async Task AsyncButton(object sender, ButtonTask mainTask, CancelTask cancelTaks, string waitText = WaitText)
        {
            if (sender is Button button)
            {
                if (button.Content is string prevText)
                {
                    if (prevText == waitText)
                    {
                        cancelTaks();
                        return;
                    }
                    button.Content = waitText;
                    await mainTask();

                    button.Content = prevText;
                }
            }
        }