Inheritance: MonoBehaviour
    // ####################################################################################################################################### Set button text

    /// <summary>
    /// Set specific action for specific button
    /// </summary>
    /// <param name="Button"></param>
    /// <param name="Action"></param>
    public void SetAction(ActionButton Button, Action Action)
    {
        // Button
        Text txt = null;
        switch (Button)
        {
            case ActionButton.A:
                txt = txt_a;
                if (a_action == Action)
                {                    
                    return;
                }
                a_action = Action;
                break;
            case ActionButton.X:
                txt = txt_x;
                if (x_action == Action)
                {                    
                    return;
                }
                x_action = Action;
                break;
        }
        // Set text
        switch (Action)
        {
            case Action.Attack:
                txt.text = "Attack";
                break;
            case Action.Draw:
                txt.text = "Draw Sword";
                break;
            case Action.Roll:
                txt.text = "Roll";
                break;
            case Action.Sheath:
                txt.text = "Put Away";
                break;
            case Action.None:
                txt.text = "";
                break;
            case Action.Speak:
                txt.text = "Speak";
                break;
            case Action.Dodge:
                txt.text = "Dodge";
                break;
            case Action.Jump:
                txt.text = "Jump";
                break;
        }
    }
Exemple #2
0
    private static void CreateTooltip(string text, ActionButton btn)
    {
        TooltipContent btnTooltip = btn.gameObject.AddComponent <TooltipContent>();

        btnTooltip.enabled = true;

        if (btnTooltip.tooltipRect == null)
        {
            btnTooltip.tooltipRect = Base.GameManager.Instance.Tooltip;
        }
        if (btnTooltip.descriptionText == null)
        {
            btnTooltip.descriptionText = Base.GameManager.Instance.Text;
        }
        btnTooltip.description = text;
    }
Exemple #3
0
        public BaseMapsView(Context context) : base(context,
                                                    Resource.Drawable.icon_info_blue,
                                                    Resource.Drawable.icon_back_blue,
                                                    Resource.Drawable.icon_close,
                                                    Resource.Drawable.icon_info_white)
        {
            BasemapButton = new ActionButton(context, Resource.Drawable.icon_basemap);
            AddButton(BasemapButton);
            StyleContent = new StylePopupContent(context);

            LanguageButton = new ActionButton(context, Resource.Drawable.icon_language);
            AddButton(LanguageButton);
            LanguageContent = new LanguagePopupContent(context);

            Frame = new CGRect(0, 0, Metrics.WidthPixels, UsableHeight);
        }
Exemple #4
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            var layout = new RelativeLayout();

            Content = layout;

            var ab = new ActionButton {
                ButtonColor = Color.FromHex("#E91E63"),
                ButtonIcon  = FontAwesomeLabel.FAThumbsUp,
            };

            layout.Children.Add(ab, () => new Rectangle((layout.Width / 4) - (56 / 2), (layout.Height / 2) - (56 / 2), 56, 56));

            var abtgl = new ToggleActionButton {
                ButtonColor = Color.FromHex("#FF5722"),
                ButtonIcon  = FontAwesomeLabel.FAPlus,
            };

            abtgl.SetBinding(IsToggledProperty, "IsToggled");
            layout.Children.Add(abtgl, () => new Rectangle((layout.Width / 2) - (56 / 2), (layout.Height / 2) - (56 / 2), 56, 56));

            _command = new Command((obj) => {}, (obj) => abtgl.IsToggled);

            var playButton = new ActionButton {
                ButtonColor = Color.FromHex("#2196F3"),
                ButtonIcon  = FontAwesomeLabel.FAPlay,
                Command     = _command,
            };

            var abex = new ExpandableActionButton {
                ButtonColor = Color.FromHex("#FF9800"),
                Buttons     =
                {
                    playButton,
                    new ActionButton {
                        ButtonColor = Color.FromHex("#009688"),ButtonIcon                                  = FontAwesomeLabel.FATag
                    },
                    new ActionButton {
                        ButtonColor = Color.FromHex("#CDDC39"),ButtonIcon                                  = FontAwesomeLabel.FARoad
                    },
                }
            };

            layout.Children.Add(abex, () => new Rectangle(((layout.Width / 4) * 3) - (56 / 2), (layout.Height / 2) - (200), 56, 250));
        }
    // private int nBeginIndex = 0;
    void Awake()
    {
        foreach (GameObject item in items)
        {
            SpriteText[] texts = item.GetComponentsInChildren <SpriteText>();
            for (int i = 0; i < texts.Length; i++)
            {
                if (texts[i].gameObject.name == "NameLabel")
                {
                    txtNames.Add(texts[i]);
                }
                else if (texts[i].gameObject.name == "LevelLabel")
                {
                    txtLevels.Add(texts[i]);
                }
            }
            ActionButton action = item.GetComponentInChildren <ActionButton>();
            if (action != null)
            {
                buttons.Add(action);
            }
            UIButton[] btns = item.GetComponentsInChildren <UIButton>();
            for (int i = 0; i < btns.Length; i++)
            {
                if (btns[i].gameObject.name == "LevelUp")
                {
                    levelUpBtns.Add(btns[i]);
                }
                else if (btns[i].gameObject.name == "Bg")
                {
                    bgBtns.Add(btns[i]);
                    // 屏蔽背景的Tooltip [4/10/2012 Ivan]
                    //btns[i].SetInputDelegate(handlerInput);
                    toolText.Add(null);
                }
            }
        }
        txtExp   = transform.FindChild("exp_text").GetComponent <SpriteText>();
        txtMoney = transform.FindChild("money_text").GetComponent <SpriteText>();

        //gameObject.SetActiveRecursively(false);
        UpdateSkill();
        UpdateMoney();
        UpdateExp();

        registerHandler();
    }
    public ActionButton GetButton()
    {
        ActionButton ActButton = Instantiate(Button);

        if (icon != null)
        {
            ActButton.GetComponent <Image>().sprite        = icon;
            ActButton.GetComponentInChildren <Text>().text = "";
        }
        else
        {
            ActButton.GetComponentInChildren <Text>().text = this.Name;
        }
        ActButton.SetActionToDo(this);

        return(ActButton);
    }
Exemple #7
0
 private void InvoiceNumRadButton_Click(object sender, EventArgs e)
 {
     try
     {
         InvoiceNumberRadForm _form = new InvoiceNumberRadForm(this);
         _form.ShowDialog();
         SetUpBasicData();
         ActionButtonSelected = ActionButton.InvoiceNumSelected;
         PaidAccountsDetailsRadGridView.DataSource = null;
         DayDelayRadLabel.ForeColor = Color.Black;
     }
     catch (PaidAccountsNotFoundException ex)
     {
         RadMessageBox.Show(ex.Message, "JOSIAS INDUSTRIAL SRL", MessageBoxButtons.OK, RadMessageIcon.Error);
         return;
     }
 }
        public static void SetButtonText(this ActionButton actionButton, string text) //actionButton.prop_String_0
        {
            if (actionButtonTextProperty != null)
            {
                setActionButtonText(actionButton, text);
                return;
            }

            actionButtonTextProperty = typeof(ActionButton).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                       .Single(
                p => p.PropertyType == typeof(string) && ((string)p.GetValue(actionButton)).Equals("Button Text")
                );
            setActionButtonText =
                (Action <ActionButton, string>)Delegate.CreateDelegate(typeof(Action <ActionButton, string>),
                                                                       actionButtonTextProperty.GetSetMethod());
            setActionButtonText(actionButton, text);
        }
Exemple #9
0
        private void LoadCharacterTemplates(IWhisperDatasource datasource)
        {
            log.Info("loading character templates...");
            datasource.ExecuteQuery("select race, class, map_id, zone_id, position_x, position_y, position_z, orientation from character_template", ctReader =>
            {
                var templates = new Dictionary <Race, IDictionary <Class, CharacterTemplate> >();

                while (ctReader.Read())
                {
                    byte race   = ctReader.GetByte(0);
                    byte @class = ctReader.GetByte(1);

                    int buttonCount = 0;
                    ActionButton[] actionButtons = new ActionButton[Character.MaxActionButtons];
                    datasource.ExecuteQuery("select button, action, type from character_template_action_button where race = ? and class = ? limit ?", new object[] { race, @class, Character.MaxActionButtons }, abReader =>
                    {
                        while (abReader.Read())
                        {
                            actionButtons[abReader.GetInt16(0)] = new ActionButton(abReader.GetInt32(1), (ActionButton.Type)abReader.GetByte(2));
                            ++buttonCount;
                        }
                    });

                    IList <int> spells = new List <int>();
                    datasource.ExecuteQuery("select spell_id from character_template_spell where race = ? and class = ?", new object[] { race, @class }, sReader =>
                    {
                        while (sReader.Read())
                        {
                            spells.Add(sReader.GetInt32(0));
                        }
                    });

                    CharacterTemplate template = new CharacterTemplate(race, @class, ctReader.GetInt32(2), ctReader.GetInt32(3), ctReader.GetFloat(4), ctReader.GetFloat(5), ctReader.GetFloat(6), ctReader.GetFloat(7), actionButtons, spells);

                    if (!templates.ContainsKey(template.Race))
                    {
                        templates.Add(template.Race, new Dictionary <Class, CharacterTemplate>());
                    }

                    templates[template.Race].Add(template.Class, template);
                    log.DebugFormat("loaded character template for {0} {1} with {2} spells and {3} buttons", template.Race, template.Class, template.SpellIDs.Count, buttonCount);
                }

                CharacterTemplates = templates;
            });
        }
Exemple #10
0
    void Awake()
    {
        if (buttonA == null)
        {
            GameObject buttonObj = GameObject.Find(Constants.BUTTON_A_TAG);
            buttonA = buttonObj.GetComponent <ActionButton>();
            buttonA.Disable();
        }
        if (player == null)
        {
            player = GameObject.Find(Constants.PLAYER_TAG).GetComponent <Player>();
        }

        call = delegate {
            Interact(player);
        };
    }
Exemple #11
0
    private void AddButton(CharacterAction action, Character cData)
    {
        GameObject go = Instantiate(Button_Template) as GameObject;

        go.SetActive(true);
        go.name = action.ID;
        ActionButton TB = go.GetComponent <ActionButton>();

        TB.SetName(action.Name.ToUpper());
        TB.SetID(action.ID);
        TB.SetCharacter(activeChar.ID); // attaches button to character
        //TB.SetPicture(cha.PictureID);
        go.transform.SetParent(Button_Template.transform.parent);
        go.transform.localScale    = new Vector3(1, 1, 1); // to offset canvas scaling
        go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0);
        buttonList.Add(go);
    }
Exemple #12
0
        private ActionButton CreateActionButton(string command, string icon)
        {
            ActionButton btn = new ActionButton();

            btn.Command = command;
            btn.Style   = String.Format(
                "background: transparent url({0}) left center no-repeat;",
                PortalUtils.GetThemedImage(String.Format("VPS2012/{0}", icon)));

            string localizedText = GetLocalizedString("Command." + command);

            btn.Text = localizedText != null ? localizedText : command;

            btn.OnClientClick = GetLocalizedString("OnClientClick." + command);

            return(btn);
        }
Exemple #13
0
        public void FinalizeDataHolder()
        {
            List <Archetype> archetypes = ArchetypeMgr.GetArchetypes(this.Race, this.Class);

            if (archetypes == null)
            {
                ContentMgr.OnInvalidDBData(this.GetType().Name + " \"{0}\" refers to invalid Archetype: {1} {2}.",
                                           (object)this, (object)this.Race, (object)this.Class);
            }
            else
            {
                foreach (Archetype archetype in archetypes)
                {
                    ActionButton.Set(archetype.ActionButtons, this.Index, this.Action, this.Type, this.Info);
                }
            }
        }
        private void Colour_Clicked(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                ActionButton button = (ActionButton)sender;

                this.SelectedColour = button.Background;

                this.DialogResult = true;

                this.Close();
            }
            catch (Exception err)
            {
                MessageDisplay.Show(TranslationDictionary.Translate(err.InnerExceptionMessage()));
            }
        }
        private void Rebind()
        {
            if (!canRebind || currentEntry == null)
            {
                return;
            }

            var res = activity.Resources;

            if (currentEntry.State == TimeEntryState.New && currentEntry.StopTime.HasValue)
            {
                // Save button
                ActionButton.Text = res.GetString(Resource.String.TimerSaveButtonText);
                ActionButton.SetBackgroundColor(res.GetColor(Resource.Color.gray));
            }
            else if (currentEntry.State == TimeEntryState.Running)
            {
                // Stop button
                ActionButton.Text = res.GetString(Resource.String.TimerStopButtonText);
                ActionButton.SetBackgroundColor(res.GetColor(Resource.Color.bright_red));
            }
            else
            {
                // Start button
                ActionButton.Text = res.GetString(Resource.String.TimerStartButtonText);
                ActionButton.SetBackgroundColor(res.GetColor(Resource.Color.bright_green));
            }

            ActionButton.Visibility = HideAction ? ViewStates.Gone : ViewStates.Visible;

            if (currentEntry.State == TimeEntryState.Running && !HideDuration)
            {
                var duration = currentEntry.GetDuration();
                DurationTextView.Text       = TimeSpan.FromSeconds((long)duration.TotalSeconds).ToString();
                DurationTextView.Visibility = ViewStates.Visible;

                // Schedule next rebind:
                handler.RemoveCallbacks(Rebind);
                handler.PostDelayed(Rebind, 1000 - duration.Milliseconds);
            }
            else
            {
                DurationTextView.Visibility = ViewStates.Gone;
            }
        }
    public void callActionButtonFunction(MessageRunAction msg)
    {
        ActionButton ab = ActionButton.BUTTON_LIST[msg.buttonID];

        if (msg.childIndex != -1)
        {
            ab = ((ActionButtonParent)ab).getChildButtons()[msg.childIndex];
        }

        List <SidedEntity> list = new List <SidedEntity>();

        foreach (GameObject obj in msg.targets)
        {
            list.Add(obj.GetComponent <SidedEntity>());
        }

        ab.callFunction(list);
    }
Exemple #17
0
 void ReleaseDesignerOutlets()
 {
     if (ActionButton != null)
     {
         ActionButton.Dispose();
         ActionButton = null;
     }
     if (DocumentText != null)
     {
         DocumentText.Dispose();
         DocumentText = null;
     }
     if (SaveButton != null)
     {
         SaveButton.Dispose();
         SaveButton = null;
     }
 }
    public void PopulateActionsMenu(List <Action> actions, Vector3 mousePos)
    {
        if (actionMenuOpen)
        {
            return;
        }

        foreach (var action in actions)
        {
            ActionButton actionButton = Instantiate(actionButtonPrefab, actionButtonParent).GetComponent <ActionButton>();
            actionButtonParent.position = mousePos;
            actionButton.SetUp(action);
        }
        if (actions.Count > 0)
        {
            actionMenuOpen = true;
        }
    }
        internal void Show()
        {
            if (parent == null)
            {
                return;
            }

            ParamTextField.value = m_PlaceHolderText;
            ParamTextField.visualInput.Focus();
            ParamTextField.visualInput.RegisterCallback <KeyDownEvent>(OnKeyDownShortcut);

            ActionButton.SetEnabled(!string.IsNullOrEmpty(m_PlaceHolderText));

            foreach (var element in parent.Children())
            {
                element.SetEnabled(element == this);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ActionButton != null)
            {
                ActionButton.Dispose();
                ActionButton = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (Counter != null)
            {
                Counter.Dispose();
                Counter = null;
            }

            if (DahaSonraButton != null)
            {
                DahaSonraButton.Dispose();
                DahaSonraButton = null;
            }

            if (Hazne1 != null)
            {
                Hazne1.Dispose();
                Hazne1 = null;
            }

            if (MentionLabel != null)
            {
                MentionLabel.Dispose();
                MentionLabel = null;
            }

            if (ProgressHazne != null)
            {
                ProgressHazne.Dispose();
                ProgressHazne = null;
            }
        }
    /// <summary>
    /// Initializes the action buttons to represent the numbers contained within the 'values' parameter. The array must contain three values.
    /// </summary>
    /// <param name="values">An array of the values that each button should represent.</param>
    internal void InitActionButtons(int[] values)
    {
        if (values.Length == 3)
        {
            buttonSequence = new ActionSequence();

            for (int i = 0; i < ActionButtons.Length; i++)
            {
                int          spriteIndex = values[i] - 1;
                ActionButton ab          = ActionButtons[i];
                ab.IsSelected = false;
                ab.InitActionButton(ButtonHeight, DefaultSprites[spriteIndex], SelectedSprites[spriteIndex], values[i]);
            }

            AttackButton.InitAttackButton(ButtonHeight);

            if (!InitializedButtonPositions)
            {
                //Calculations for positioning.
                RectTransform canvas               = gameObject.transform.root.transform as RectTransform;
                float         attackButtonOffset   = .025f * canvas.sizeDelta.x;
                float         bottomMargin         = .025f * canvas.sizeDelta.y;
                float         totalWidthOfButtons  = ActionButtons.Length * ActionButtons[0].Width + attackButtonOffset + AttackButton.Width;
                float         remainingCanvasWidth = canvas.sizeDelta.x - totalWidthOfButtons;

                //Set positions.
                float totalOffset = remainingCanvasWidth / 2;
                foreach (ActionButton button in ActionButtons)
                {
                    button.SetAbsolutePosition(totalOffset, bottomMargin);
                    totalOffset += button.Width;
                }
                totalOffset += attackButtonOffset;
                AttackButton.SetAbsolutePosition(totalOffset, bottomMargin);

                InitializedButtonPositions = true;
            }
        }
        else
        {
            throw new UnityException(
                      string.Format("Invalid array length. There exist three action buttons so 'values' int[] parameter Length must equal 3. Length = {0}", values.Length));
        }
    }
Exemple #22
0
    void Awake()
    {
        button1 = NameButton.GetComponent <SpriteText>();
        button2 = LevelButton.GetComponent <SpriteText>();
        button3 = WuXingButton.GetComponent <ActionButton>();
        button4 = AmbitButton.GetComponent <ActionButton>();
        button5 = HPButton.GetComponent <UIProgressBar>();
        button6 = MPButton.GetComponent <UIProgressBar>();


        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_NAME, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_LEVEL, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_AMBIT, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HP, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_MP, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_ENERGY, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_MONEY, PlayerFrame_Update);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_RMB, PlayerFrame_Update);
    }
    public void onActionButtonClick(ActionButton ab)
    {
        player = GameObject.FindGameObjectWithTag ("MyFisher");

        switch (ab) {
        case ActionButton.ab1:
            addItem ();
            break;
        case ActionButton.ab2:
            removeInventoryItems ();
            break;
        case ActionButton.ab3:
            break;
        case ActionButton.ab4:
            break;
        default:
            break;
        }
    }
Exemple #24
0
    public void ShowActionMenu(Agent target)
    {
        GameManager.Instance.PauseGame();
        panelStack++;
        ActionMenu.gameObject.SetActive(true);
        for (int i = 0; i < ActionMenuContainer.childCount; i++)
        {
            Destroy(ActionMenuContainer.GetChild(i).gameObject);
        }

        foreach (var b in target.possibleBehaviours)
        {
            ActionButton btn = Instantiate(actionButton).GetComponent <ActionButton>();
            btn.agent = target;
            btn.behav = b;
            btn.DisplayText();
            btn.transform.parent = ActionMenuContainer;
        }
    }
        /// <summary>
        /// Add a button segment to the control
        /// </summary>
        /// <param name="content">The content of the button, either text or image</param>
        /// <param name="helpTitle">The title of the help window that appears on hover</param>
        /// <param name="helpMessage">The message in the help window that appears on hover</param>
        /// <param name="isPrimary">Indicates how the button should be styled</param>
        private void AddButton(object content, string automationName, IQuickHelpControlBuilder?helpBuilder, bool isPrimary)
        {
            var button = new ActionButton();

            // We started with a design that had two styles of buttons: primary and secondary
            // They featured different background shades, but the lighter shade was too low of
            // contrast wit the white text for users who need high contrast.  So we're now
            // using only the primary style and adding a space in between the buttons
            button.Style       = CreatePrimaryButtonStyle();
            button.Content     = content;
            button.HelpBuilder = helpBuilder;
            AutomationProperties.SetName(button, automationName);
            button.Click += Button_Click;
            if (ActionStack.Children.Count > 0)
            {
                button.Margin = new Thickness(1, 0, 0, 0);
            }
            ActionStack.Children.Add(button);
        }
Exemple #26
0
    /// <summary>
    /// Update the actions shown on the buttons and their visibility.
    /// </summary>
    private void RefreshButtons()
    {
        // Populate buttons with actor's actions
        for (int i = 0; i < actionButtons.Length; i++)
        {
            ActionButton button = actionButtons[i];

            // Enable / Disable button
            bool enabled = i < ActionCount;
            button.gameObject.SetActive(enabled);

            if (enabled)
            {
                // Set the button's associated action.
                BattleAction action = ActionManager.Instance.SelectedActor.Actions[i];
                button.SetAction(action);
            }
        }
    }
        void Update()
        {
            ActionButton    action    = LegacyInputManager.GetPressedActionButton();
            DirectionButton dir       = m_animationController.GetLastAnimationDirection();
            Vector3         dirVector = LegacyInputManager.GetDirectionButtonVector(dir);
            RaycastHit2D    hit       = CheckInteractableRaycast(dirVector);

            if (!hit || !hit.collider || !hit.collider.gameObject.HasComponent <Interactable>())
            {
                Debug.DrawRay(transform.position, dirVector, Color.red);
                Debug.DrawRay(transform.position, hit.point, Color.blue);
                return;
            }

            Debug.DrawRay(transform.position, dirVector, Color.green);
            Debug.DrawRay(transform.position, hit.point, Color.blue);

            hit.collider.gameObject.GetComponent <Interactable>()
            .Interact(new InteractionContext(dir, action, m_DialogManager));
        }
        void ReleaseDesignerOutlets()
        {
            if (ActionButton != null)
            {
                ActionButton.Dispose();
                ActionButton = null;
            }

            if (Placeholder != null)
            {
                Placeholder.Dispose();
                Placeholder = null;
            }

            if (TextView != null)
            {
                TextView.Dispose();
                TextView = null;
            }
        }
 void levelUpInputDelegate(ref POINTER_INFO ptr)
 {
     if (ptr.evt == POINTER_INFO.INPUT_EVENT.TAP)
     {
         Transform    parent    = ptr.targetObj.gameObject.transform.parent;
         ActionButton actionBtn = parent.FindChild("Icon").gameObject.GetComponent <ActionButton>();
         if (actionBtn != null)
         {
             CActionItem_Skill skillAction = actionBtn.CurrActionItem as CActionItem_Skill;
             if (skillAction != null)
             {
                 SCLIENT_SKILL skill = skillAction.GetImpl() as SCLIENT_SKILL;
                 if (skill != null)
                 {
                     CDataPool.Instance._StudySkill.SendStudySkillEvent(skill.m_pDefine.m_nSkillClass, skill.m_pDefine.m_nMenPai, 1);
                 }
             }
         }
     }
 }
Exemple #30
0
 private void checkButtonInteractability(ActionButton actionBtn, ButtonWrapper btnWrapper)
 {
     if (this.player.selectedBuilding.isSelected())
     {
         btnWrapper.setInteractable(!actionBtn.shouldDisable(this.player.selectedBuilding.getBuilding()));
     }
     else
     {
         bool notInteractable = true;
         int  buttonMask      = actionBtn.getMask();
         foreach (UnitBase entity in this.player.selectedParty.getAllUnits())
         {
             if ((entity.getButtonMask() & buttonMask) != 0)
             {
                 notInteractable &= actionBtn.shouldDisable(entity) || !entity.isTaskCancelable();
             }
         }
         btnWrapper.setInteractable(!notInteractable);
     }
 }
Exemple #31
0
    public void SetDialog(Action actionDialog)
    {
        this.gameObject.SetActive(true);
        clearActions();

        foreach (KeyValuePair <string, int> dialog in actionDialog.Actions)
        {
            GameObject newAction = (GameObject)Instantiate(actionPrefab);

            newAction.name = "Actions";

            newAction.transform.SetParent(this.transform);

            ActionButton actionButton = newAction.GetComponent <ActionButton>();

            actionButton.SetButton(dialog.Value, dialog.Key);

            actions.Add(newAction);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        ab1 = new ActionButton();
        ab2 = new ActionButton();
        ab3 = new ActionButton();

        b1.onClick.AddListener(() =>
        {
            onButtonClick(ab1);
        });
        b2.onClick.AddListener(() =>
        {
            onButtonClick(ab2);
        });
        b3.onClick.AddListener(() =>
        {
            onButtonClick(ab3);
        });
        parseActions();
    }
    /// <summary>
    /// Selects or Deselects the clicked button.
    /// </summary>
    /// <param name="button"></param>
    public void ActionButtonClicked(ActionButton button)
    {
        if (!button.IsSelected)
        {
            button.IsSelected = true;
            buttonSequence.Add(button);
        }
        else
        {
            button.IsSelected = false;
            buttonSequence.Remove(button);
        }

        if (buttonSequence.Count > 1)
        {
            AttackButton.IsEnabled = true;
        }
        else if (AttackButton.IsEnabled)
        {
            AttackButton.IsEnabled = false;
        }
    }
		protected override void OnAppearing ()
		{
			base.OnAppearing ();

			var layout = new RelativeLayout ();
			Content = layout;

			var ab = new ActionButton {
				ButtonColor = Color.FromHex("#E91E63"),
				ButtonIcon = FontAwesomeLabel.FAThumbsUp,
			};
			layout.Children.Add(ab, () => new Rectangle((layout.Width/4)-(56/2), (layout.Height/2)-(56/2), 56, 56));

			var abtgl = new ToggleActionButton {
				ButtonColor = Color.FromHex("#FF5722"),
				ButtonIcon = FontAwesomeLabel.FAPlus,
			};
			abtgl.SetBinding (IsToggledProperty, "IsToggled");
			layout.Children.Add(abtgl, () => new Rectangle((layout.Width/2)-(56/2), (layout.Height/2)-(56/2), 56, 56));

			_command = new Command ((obj) => {}, (obj) => abtgl.IsToggled);

			var playButton = new ActionButton{ 
				ButtonColor = Color.FromHex ("#2196F3"), 
				ButtonIcon = FontAwesomeLabel.FAPlay,
				Command = _command,
			};

			var abex = new ExpandableActionButton {
				ButtonColor = Color.FromHex("#FF9800"),
				Buttons = {
					playButton,
					new ActionButton{ ButtonColor = Color.FromHex("#009688"), ButtonIcon = FontAwesomeLabel.FATag},
					new ActionButton{ ButtonColor = Color.FromHex("#CDDC39"), ButtonIcon = FontAwesomeLabel.FARoad},
				}
			};
			layout.Children.Add(abex, () => new Rectangle(((layout.Width/4)*3)-(56/2), (layout.Height/2)-(200), 56, 250));
		}
 public bool TrySelectRitualAction(ActionButton button, Player play)
 {
     if (play == Player.Red && acceptingInput)
     {
         if (currentSelectionRed == RitualObjectId.NONE)
         {
             return false;
         }
         else
         {
             DisplaySelection(currentSelectionRed, (RitualObjAnimation)button, play);
             return true;
         }
     }
     else if (play == Player.Blue && acceptingInput)
     {
         if (currentSelectionBlue == RitualObjectId.NONE)
         {
             return false;
         }
         else
         {
             DisplaySelection(currentSelectionBlue, (RitualObjAnimation)button, play);
             return true;
         }
     }
     return false;
 }
        public MiniMode()
            : base(Branding.ApplicationLongName)
        {
            default_main_window = InterfaceElements.MainWindow;

            glade = new Glade.XML(null, "minimode.glade", "MiniModeWindow", null);
            glade.Autoconnect(this);

            Widget child = glade["mini_mode_contents"];
            (child.Parent as Container).Remove(child);
            Add(child);
            BorderWidth = 12;
            Resizable = false;

            IconThemeUtils.SetWindowIcon(this);
            DeleteEvent += delegate {
                Globals.ActionManager["QuitAction"].Activate();
            };

            // Playback Buttons
            ActionButton previous_button = new ActionButton(Globals.ActionManager["PreviousAction"]);
            previous_button.LabelVisible = false;
            previous_button.Padding = 1;

            ActionButton next_button = new ActionButton(Globals.ActionManager["NextAction"]);
            next_button.LabelVisible = false;
            next_button.Padding = 1;

            ActionButton playpause_button = new ActionButton(Globals.ActionManager["PlayPauseAction"]);
            playpause_button.LabelVisible = false;
            playpause_button.Padding = 1;

            PlaybackBox.PackStart(previous_button, false, false, 0);
            PlaybackBox.PackStart(playpause_button, false, false, 0);
            PlaybackBox.PackStart(next_button, false, false, 0);
            PlaybackBox.ShowAll();

            // Seek Slider/Position Label
            seek_slider = new SeekSlider();
            seek_slider.SetSizeRequest(125, -1);
            seek_slider.SeekRequested += delegate {
                PlayerEngineCore.Position = (uint)seek_slider.Value;
            };

            stream_position_label = new StreamPositionLabel(seek_slider);

            SeekContainer.PackStart(seek_slider, false, false, 0);
            SeekContainer.PackStart(stream_position_label, false, false, 0);
            SeekContainer.ShowAll();

            // Volume button
            volume_button = new VolumeButton();
            VolumeContainer.PackStart(volume_button, false, false, 0);
            volume_button.Show();
            volume_button.VolumeChanged += delegate(int volume) {
                PlayerEngineCore.Volume = (ushort)volume;
                PlayerEngineCore.VolumeSchema.Set(volume);
            };

            // Cover
            cover_art_thumbnail = new CoverArtThumbnail(90);
            Gdk.Pixbuf default_pixbuf = Banshee.Base.Branding.DefaultCoverArt;
            cover_art_thumbnail.NoArtworkPixbuf = default_pixbuf;
            CoverBox.PackStart(cover_art_thumbnail, false, false, 0);

            // Source combobox
            source_combo_box = new SourceComboBox();
            SourceBox.PackStart(source_combo_box, true, true, 0);
            source_combo_box.ShowAll();

            // Repeat/Shuffle buttons
            MultiStateToggleButton shuffle_toggle_button = new MultiStateToggleButton();
            shuffle_toggle_button.AddState(typeof(ShuffleDisabledToggleState),
                    Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.AddState(typeof(ShuffleEnabledToggleState),
                    Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.Relief = ReliefStyle.None;
            shuffle_toggle_button.ShowLabel = false;
            try {
                shuffle_toggle_button.ActiveStateIndex = PlayerWindowSchema.PlaybackShuffle.Get() ? 1 : 0;
            } catch {
                shuffle_toggle_button.ActiveStateIndex = 0;
            }
            shuffle_toggle_button.ShowAll();

            MultiStateToggleButton repeat_toggle_button = new MultiStateToggleButton();
            repeat_toggle_button.AddState(typeof(RepeatNoneToggleState),
                Globals.ActionManager["RepeatNoneAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatAllToggleState),
                Globals.ActionManager["RepeatAllAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatSingleToggleState),
                Globals.ActionManager["RepeatSingleAction"] as ToggleAction);
            repeat_toggle_button.Relief = ReliefStyle.None;
            repeat_toggle_button.ShowLabel = false;
            try {
                repeat_toggle_button.ActiveStateIndex = (int)PlayerWindowSchema.PlaybackRepeat.Get();
            } catch {
                repeat_toggle_button.ActiveStateIndex = 0;
            }
            repeat_toggle_button.ShowAll();

            LowerButtonsBox.PackEnd(repeat_toggle_button, false, false, 0);
            LowerButtonsBox.PackEnd(shuffle_toggle_button, false, false, 0);
            LowerButtonsBox.ShowAll();

            // Tooltips
            toolTips = new Tooltips();

            SetTip(previous_button, Catalog.GetString("Play previous song"));
            SetTip(playpause_button, Catalog.GetString("Play/pause current song"));
            SetTip(next_button, Catalog.GetString("Play next song"));
            SetTip(fullmode_button, Catalog.GetString("Switch back to full mode"));
            SetTip(volume_button, Catalog.GetString("Adjust volume"));
            SetTip(repeat_toggle_button, Catalog.GetString("Change repeat playback mode"));
            SetTip(shuffle_toggle_button, Catalog.GetString("Toggle shuffle playback mode"));

            // Hook up everything
            PlayerEngineCore.EventChanged += OnPlayerEngineEventChanged;
            PlayerEngineCore.StateChanged += OnPlayerEngineStateChanged;

            SetHeightLimit();
        }
        public MiniMode()
        {
            glade = new Glade.XML(null, "minimode.glade", "MiniModeWindow", "banshee");
            glade.Autoconnect(this);
            if(MiniModeWindow == null)
                throw new Exception(); // This propagate Glade errors to Banshee's plugin framework
            IconThemeUtils.SetWindowIcon(MiniModeWindow);
            MiniModeWindow.DeleteEvent += delegate {
                PlayerCore.UserInterface.Quit();
            };

            // Playback Buttons
            ActionButton previous_button = new ActionButton(Globals.ActionManager["PreviousAction"]);
            previous_button.LabelVisible = false;
            previous_button.Padding = 1;

            ActionButton next_button = new ActionButton(Globals.ActionManager["NextAction"]);
            next_button.LabelVisible = false;
            next_button.Padding = 1;

            ActionButton playpause_button = new ActionButton(Globals.ActionManager["PlayPauseAction"]);
            playpause_button.LabelVisible = false;
            playpause_button.Padding = 1;

            PlaybackBox.PackStart(previous_button, false, false, 0);
            PlaybackBox.PackStart(playpause_button, false, false, 0);
            PlaybackBox.PackStart(next_button, false, false, 0);
            PlaybackBox.ShowAll();

            // Seek Slider/Position Label
            seek_slider = new SeekSlider();
            seek_slider.SetSizeRequest(125, -1);
            seek_slider.SeekRequested += delegate {
                PlayerEngineCore.Position = (uint)seek_slider.Value;
            };

            stream_position_label = new StreamPositionLabel(seek_slider);

            SeekContainer.PackStart(seek_slider, false, false, 0);
            SeekContainer.PackStart(stream_position_label, false, false, 0);
            SeekContainer.ShowAll();

            // Volume button
            volumeButton = new VolumeButton();
            VolumeContainer.PackStart(volumeButton, false, false, 0);
            volumeButton.Show();
            volumeButton.VolumeChanged += delegate(int volume) {
                PlayerEngineCore.Volume = (ushort)volume;
                Globals.Configuration.Set(GConfKeys.Volume, volume);
            };

            // Cover
            coverArtThumbnail = new CoverArtThumbnail(90);
            Gdk.Pixbuf default_pixbuf = Banshee.Base.IconThemeUtils.LoadIcon("audio-x-generic", 128);
            if(default_pixbuf == null) {
                default_pixbuf = new Gdk.Pixbuf(System.Reflection.Assembly.GetEntryAssembly(), "banshee-logo.png");
            }
            coverArtThumbnail.NoArtworkPixbuf = default_pixbuf;
            CoverBox.PackStart(coverArtThumbnail, false, false, 0);

            // Source combobox
            sourceComboBox = new SourceComboBox();
            SourceBox.PackStart(sourceComboBox, true, true, 0);
            sourceComboBox.ShowAll();

            // Repeat/Shuffle buttons
            MultiStateToggleButton shuffle_toggle_button = new MultiStateToggleButton();
            shuffle_toggle_button.AddState(typeof(ShuffleDisabledToggleState),
                    Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.AddState(typeof(ShuffleEnabledToggleState),
                    Globals.ActionManager["ShuffleAction"] as ToggleAction);
            shuffle_toggle_button.Relief = ReliefStyle.None;
            shuffle_toggle_button.ShowLabel = false;
            shuffle_toggle_button.ShowAll();

            MultiStateToggleButton repeat_toggle_button = new MultiStateToggleButton();
            repeat_toggle_button.AddState(typeof(RepeatNoneToggleState),
                Globals.ActionManager["RepeatNoneAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatAllToggleState),
                Globals.ActionManager["RepeatAllAction"] as ToggleAction);
            repeat_toggle_button.AddState(typeof(RepeatSingleToggleState),
                Globals.ActionManager["RepeatSingleAction"] as ToggleAction);
            repeat_toggle_button.Relief = ReliefStyle.None;
            repeat_toggle_button.ShowLabel = false;
            repeat_toggle_button.ShowAll();

            LowerButtonsBox.PackEnd(repeat_toggle_button, false, false, 0);
            LowerButtonsBox.PackEnd(shuffle_toggle_button, false, false, 0);
            LowerButtonsBox.ShowAll();

            // Hook up everything
            PlayerEngineCore.EventChanged += OnPlayerEngineEventChanged;
            PlayerEngineCore.StateChanged += OnPlayerEngineStateChanged;
        }
Exemple #38
0
        public static bool IsButtonDown(ActionButton button)
        {
            KeyBinding bind = keyBindings[(int)button];

            return IsBindDown(bind);
        }
        private ActionButton CreateActionButton(string command, string icon)
        {
            ActionButton btn = new ActionButton();
            btn.Command = command;
            btn.Style = String.Format(
                "background: transparent url({0}) left center no-repeat;",
                PortalUtils.GetThemedImage(String.Format("VPS2012/{0}", icon)));

            string localizedText = GetLocalizedString("Command." + command);
            btn.Text = localizedText != null ? localizedText : command;

            btn.OnClientClick = GetLocalizedString("OnClientClick." + command);

            return btn;
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenCalculatorPopup"/> class.
		/// </summary>
		/// <param name="serviceProvider"><para>Requires:</para>
		/// 	<para><see cref="INuGenButtonStateService"/></para>
		/// 	<para><see cref="INuGenControlStateService"/></para>
		/// 	<para><see cref="INuGenButtonRenderer"/></para>
		/// 	<para><see cref="INuGenButtonLayoutManager"/></para>
		/// 	<para><see cref="INuGenPanelRenderer"/></para>
		/// 	<para><see cref="INuGenTextBoxRenderer"/></para></param>
		/// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
		public NuGenCalculatorPopup(INuGenServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.Opaque, true);
			this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.Selectable, true);
			this.SetStyle(ControlStyles.UserPaint, true);

			this.Padding = new Padding(3);

			_backspaceButton = new ActionButton(serviceProvider, ActionManager.Backspace, res.Text_Calc_Backspace);
			_backspaceButton.TabIndex = 20;

			_cButton = new ActionButton(serviceProvider, ActionManager.C, res.Text_Calc_C);
			_cButton.TabIndex = 40;

			_ceButton = new ActionButton(serviceProvider, ActionManager.CE, res.Text_Calc_CE);
			_ceButton.TabIndex = 30;
			
			_d0Button = new ActionButton(serviceProvider, ActionManager.D0, res.Text_Calc_D0);
			_d1Button = new ActionButton(serviceProvider, ActionManager.D1, res.Text_Calc_D1);
			_d2Button = new ActionButton(serviceProvider, ActionManager.D2, res.Text_Calc_D2);
			_d3Button = new ActionButton(serviceProvider, ActionManager.D3, res.Text_Calc_D3);
			_d4Button = new ActionButton(serviceProvider, ActionManager.D4, res.Text_Calc_D4);
			_d5Button = new ActionButton(serviceProvider, ActionManager.D5, res.Text_Calc_D5);
			_d6Button = new ActionButton(serviceProvider, ActionManager.D6, res.Text_Calc_D6);
			_d7Button = new ActionButton(serviceProvider, ActionManager.D7, res.Text_Calc_D7);
			_d8Button = new ActionButton(serviceProvider, ActionManager.D8, res.Text_Calc_D8);
			_d9Button = new ActionButton(serviceProvider, ActionManager.D9, res.Text_Calc_D9);
			_dotButton = new ActionButton(serviceProvider, ActionManager.Dot, res.Text_Calc_Dot);
			_signButton = new ActionButton(serviceProvider, ActionManager.Sign, res.Text_Calc_Sign);
			_divideButton = new ActionButton(serviceProvider, ActionManager.Divide, res.Text_Calc_Divide);
			_minusButton = new ActionButton(serviceProvider, ActionManager.Minus, res.Text_Calc_Minus);
			_multiplyButton = new ActionButton(serviceProvider, ActionManager.Multiply, res.Text_Calc_Multiply);
			_plusButton = new ActionButton(serviceProvider, ActionManager.Plus, res.Text_Calc_Plus);
			_evaluateButton = new ActionButton(serviceProvider, ActionManager.Evaluate, res.Text_Calc_Evaluate);
			_divXButton = new ActionButton(serviceProvider, ActionManager.DivX, res.Text_Calc_DivX);
			_percentButton = new ActionButton(serviceProvider, ActionManager.Percent, res.Text_Calc_Percent);
			_sqrtButton = new ActionButton(serviceProvider, ActionManager.Sqrt, res.Text_Calc_Sqrt);

			_engine = new Engine();
			_engine.ValueChanged += _engine_ValueChanged;

			_actionButtonLayoutPanel = new TableLayoutPanel();
			_actionButtonLayoutPanel.BackColor = Color.Transparent;

			for (int row = 0; row < 5; row++)
			{
				_actionButtonLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20));
			}

			for (int column = 0; column < 4; column++)
			{
				_actionButtonLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 25));
			}

			this.AddToRow0(_d7Button, 0);
			this.AddToRow0(_d8Button, 1);
			this.AddToRow0(_d9Button, 2);
			this.AddToRow0(_divideButton, 3);
			this.AddToRow0(_sqrtButton, 4);

			this.AddToRow1(_d4Button, 0);
			this.AddToRow1(_d5Button, 1);
			this.AddToRow1(_d6Button, 2);
			this.AddToRow1(_multiplyButton, 3);
			this.AddToRow1(_percentButton, 4);

			this.AddToRow2(_d1Button, 0);
			this.AddToRow2(_d2Button, 1);
			this.AddToRow2(_d3Button, 2);
			this.AddToRow2(_minusButton, 3);
			this.AddToRow2(_divXButton, 4);

			this.AddToRow3(_d0Button, 0);
			this.AddToRow3(_signButton, 1);
			this.AddToRow3(_dotButton, 2);
			this.AddToRow3(_plusButton, 3);
			this.AddToRow3(_evaluateButton, 4);

			foreach (ActionButton button in _actionButtonLayoutPanel.Controls)
			{
				button.Dock = DockStyle.Fill;
				button.Click += _actionButton_Click;
			}

			_actionButtonLayoutPanel.Dock = DockStyle.Fill;
			_actionButtonLayoutPanel.Parent = this;
			_actionButtonLayoutPanel.TabIndex = 10;

			_editLayoutPanel = new TableLayoutPanel();
			_editLayoutPanel.BackColor = Color.Transparent;

			_editLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40));
			_editLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30));
			_editLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30));
			_editLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 40));
			_editLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 60));

			_editLayoutPanel.Controls.Add(_backspaceButton, 0, 1);
			_editLayoutPanel.Controls.Add(_ceButton, 1, 1);
			_editLayoutPanel.Controls.Add(_cButton, 2, 1);

			foreach (ActionButton button in _editLayoutPanel.Controls)
			{
				button.Dock = DockStyle.Fill;
				button.Click += _actionButton_Click;
			}

			_valueDisplayTextBox = new NuGenTextBox(serviceProvider);
			_valueDisplayTextBox.Dock = DockStyle.Fill;
			_valueDisplayTextBox.ReadOnly = true;
			_valueDisplayTextBox.RightToLeft = RightToLeft.Yes;
			_valueDisplayTextBox.TabIndex = 10;
			_valueDisplayTextBox.Text = this.GetEngineValue();

			_editLayoutPanel.Controls.Add(_valueDisplayTextBox, 0, 0);
			_editLayoutPanel.SetColumnSpan(_valueDisplayTextBox, 3);

			_editLayoutPanel.Dock = DockStyle.Top;
			_editLayoutPanel.Height = 66;
			_editLayoutPanel.Parent = this;
			_editLayoutPanel.TabIndex = 10;

			_hotKeys = new NuGenHotKeys();

			this.AddOperation(this.D0, Keys.D0);
			this.AddOperation(this.D1, Keys.D1);
			this.AddOperation(this.D2, Keys.D2);
			this.AddOperation(this.D3, Keys.D3);
			this.AddOperation(this.D4, Keys.D4);
			this.AddOperation(this.D5, Keys.D5);
			this.AddOperation(this.D6, Keys.D6);
			this.AddOperation(this.D7, Keys.D7);
			this.AddOperation(this.D8, Keys.D8);
			this.AddOperation(this.D9, Keys.D9);
			
			this.AddOperation(this.Accept, Keys.Enter);
			this.AddOperation(this.Cancel, Keys.Escape);
		}
Exemple #41
0
	public static void HighlightButton(ActionButton actionButton){
		ClearButtonHighlights ();
		actionButton.Highlight ();
	}
Exemple #42
0
        public PacketHandlers()
        {
            setPacketSizes();
            PacketHandler temp;

            temp = new ActionButton();
            handlers.Add(PacketId.CLOSE, temp); //Close
            handlers.Add(PacketId.ACTIONBUTTON, temp); //Actionbutton #1
            handlers.Add(PacketId.ACTIONBUTTON2, temp); //Actionbutton #2
            handlers.Add(PacketId.ACTIONBUTTON3, temp); //Actionbutton #3

            temp = new ClientAction();
            handlers.Add(PacketId.IDLE, temp); //Idle
            handlers.Add(PacketId.MOVE_CAMERA, temp); //Move camera
            handlers.Add(PacketId.PING, temp); //Ping
            handlers.Add(PacketId.FOCUS, temp); //Window focus
            handlers.Add(PacketId.CLICK_MOUSE, temp); //Mouse
            handlers.Add(PacketId.WINDOW_TYPE, temp); //Window type
            handlers.Add(PacketId.SOUND_SETTINGS, temp); //Toggle sound (sounds)

            temp = new Command();
            handlers.Add(PacketId.COMMAND, temp); //Commands

            temp = new Communication();
            handlers.Add(PacketId.ADD_FRIEND, temp); //Add friend
            handlers.Add(PacketId.DELETE_FRIEND, temp); //Delete friend
            handlers.Add(PacketId.ADD_IGNORE, temp); //Add ignore
            handlers.Add(PacketId.DELETE_IGNORE, temp); //Delete ignore
            handlers.Add(PacketId.SEND_PM, temp); //Send PM
            handlers.Add(PacketId.CLAN_RANKS, temp); //Set clan ranks
            handlers.Add(PacketId.CLAN_CHAT, temp); //Join clan chat
            handlers.Add(PacketId.PUBLIC, temp); //Public chat
            handlers.Add(PacketId.CLAN_KICK, temp); //Clan chat kick
            handlers.Add(PacketId.PRIVACY_SETTINGS, temp); //public/private/trade chat settings

            temp = new Walk();
            handlers.Add(PacketId.WALK_1, temp); //Walk
            handlers.Add(PacketId.WALK_2, temp); //Walk
            handlers.Add(PacketId.WALK_3, temp); //Walk

            temp = new PlayerInteract();
            handlers.Add(PacketId.ATTACK_PLAYER, temp); //Attack
            handlers.Add(PacketId.FOLLOW, temp); //Follow
            handlers.Add(PacketId.TRADE, temp); //Trade
            handlers.Add(PacketId.MAGIC_ON_PLAYER, temp); //Magic on player

            temp = new NPCInteract();
            handlers.Add(PacketId.NPC_FIRST_CLICK, temp); //Attack
            handlers.Add(PacketId.NPC_SECOND_CLICK, temp); //Second click
            handlers.Add(PacketId.NPC_THIRD_CLICK, temp); //Third click
            handlers.Add(PacketId.NPC_FOURTH_CLICK, temp); //Fourth click
            handlers.Add(PacketId.NPC_FIFTH_CLICK, temp); //Fifth click
            handlers.Add(PacketId.NPC_EXAMINE, temp); //Examine Npc
            handlers.Add(PacketId.MAGIC_ON_NPC, temp); //Magic on NPC
            handlers.Add(PacketId.ITEM_ON_NPC, temp); //Item on NPC

            temp = new ObjectInteract();
            handlers.Add(PacketId.OBJECT_FIRST_CLICK, temp); //First click
            handlers.Add(PacketId.OBJECT_SECOND_CLICK, temp); //Second click
            handlers.Add(PacketId.OBJECT_THIRD_CLICK, temp); //Third click
            handlers.Add(PacketId.OBJECT_FOURTH_CLICK, temp); //Fourth click
            handlers.Add(PacketId.OBJECT_EXAMINE, temp); //object examine

            temp = new ItemInteract();
            handlers.Add(PacketId.EQUIP, temp); //Equip item
            handlers.Add(PacketId.ITEM_ON_ITEM, temp); //Item used on item
            handlers.Add(PacketId.INV_CLICK, temp); //Inventory click item
            handlers.Add(PacketId.ITEM_ON_OBJECT, temp); //Item used on object
            handlers.Add(PacketId.ITEM_ON_GROUND_ITEM, temp); //Item used on ground item.
            handlers.Add(PacketId.INV_OPERATE, temp); //Operate option
            handlers.Add(PacketId.INV_DROP, temp); //Drop item
            handlers.Add(PacketId.PICKUP, temp); //Pick up item
            handlers.Add(PacketId.INV_SWAP_SLOT, temp); //Swap item slot 1
            handlers.Add(PacketId.INV_SWAP_SLOT2, temp); //Swap item slot 2
            handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION1, temp); //Right click option 1
            handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION2, temp); //Right click option 2
            handlers.Add(PacketId.INV_EXAMINE_ITEM, temp); //Inventory item examine

            temp = new InterfaceOptions();
            handlers.Add(PacketId.ENTER_AMOUNT, temp); //Enter amount
            handlers.Add(PacketId.ENTER_TEXT, temp); // Enter text
            handlers.Add(PacketId.INTERFACE_CLICK_1, temp); //Option 1
            handlers.Add(PacketId.INTERFACE_CLICK_2, temp); //Option 2
            handlers.Add(PacketId.INTERFACE_CLICK_3, temp); //Option 3
            handlers.Add(PacketId.INTERFACE_CLICK_4, temp); //Option 4
            handlers.Add(PacketId.INTERFACE_CLICK_5, temp); //Option 5
            handlers.Add(PacketId.INTERFACE_CLICK_6, temp); //Option 6
            handlers.Add(PacketId.INTERFACE_CLICK_7, temp); //Option 7
            handlers.Add(PacketId.INTERFACE_CLICK_8, temp); //Option 8
            handlers.Add(PacketId.INTERFACE_CLICK_9, temp); //Option 9
            handlers.Add(PacketId.INTERFACE_CLICK_10, temp); //Option 9
            handlers.Add(PacketId.GE_SEARCH, temp); //Grand exchange search

            temp = new Unused();
            handlers.Add(PacketId.REIGON_LOADING, temp); //Region loading, varied size
            handlers.Add(PacketId.PACKET_COUNT, temp); //Sent after any click which increases 'count' in getPackets
            handlers.Add(PacketId.CLIENT_VARIABLE_30, temp); //Sent if a client variable is 30..unknown
            handlers.Add(PacketId.DODGY_PACKET, temp); //Caused by a dodgy packet

            Console.WriteLine("Binded packetHandlers");
        }
 public ActionSequence()
 {
     Count = 0;
     Queue = new ActionButton[2];
 }
    /// <summary>
    /// Adds the parameter object to the action sequence.
    /// </summary>
    /// <remarks>
    /// The object should have its state altered before being added to the Queue.
    /// </remarks>
    /// <param name="action"></param>
    public void Add(ActionButton action)
    {
        if (Count > 1)
        {
            Queue[0].IsSelected = false;

            Remove(Queue[0]);
            Add(action);
        }
        else
        {
            action.IsSelected = true;
            bool done = false;
            for (int i = 0; i < Queue.Length && !done; i++)
            {
                if (Queue[i] == null)
                {
                    Queue[i] = action;
                    Count++;
                    done = true;
                }
            }
        }
    }
 /// <summary>
 /// Removes the parameter object from the action sequence.
 /// </summary>
 /// <remarks>
 /// The object should have its state altered before it is removed from the queue.
 /// </remarks>
 /// <param name="action"></param>
 public void Remove(ActionButton action)
 {
     if (Count > 0)
     {
         if (Queue[0].Equals(action))
         {
             Queue[0] = Queue[1];
         }
         Queue[1] = null;
         Count--;
     }
 }
        private void BuildView()
        {
            podcast_view_scroller = new ScrolledWindow();

            podcast_view_scroller.ShadowType = ShadowType.In;
            podcast_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_feed_view_scroller = new ScrolledWindow();

            podcast_feed_view_scroller.ShadowType = ShadowType.In;
            podcast_feed_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_feed_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_model = new PodcastPlaylistModel ();
            podcast_feed_model = new PodcastFeedModel ();

            podcast_model.ClearModel ();
            podcast_feed_model.ClearModel ();

            podcast_model.QueueAdd (PodcastCore.Library.Podcasts);
            podcast_feed_model.QueueAdd (PodcastCore.Library.Feeds);

            podcast_view = new PodcastPlaylistView (podcast_model);
            podcast_view.ButtonPressEvent += OnPlaylistViewButtonPressEvent;

            podcast_feed_view = new PodcastFeedView (podcast_feed_model);
            podcast_feed_view.Selection.Changed += OnFeedViewSelectionChanged;
            podcast_feed_view.ButtonPressEvent += OnPodcastFeedViewButtonPressEvent;
            podcast_feed_view.SelectAll += OnSelectAllHandler;

            podcast_view_scroller.Add (podcast_view);
            podcast_feed_view_scroller.Add (podcast_feed_view);

            feed_info_pane = new HPaned ();
            feed_info_pane.Add1 (podcast_feed_view_scroller);
            // -- later-- feed_info_pane.Add2 ();

            feed_playlist_pane = new VPaned ();
            feed_playlist_pane.Add1 (feed_info_pane);
            feed_playlist_pane.Add2 (podcast_view_scroller);

            try
            {
                feed_playlist_pane.Position =
                    GConfSchemas.PlaylistSeparatorPositionSchema.Get ();
            }
            catch {
                feed_playlist_pane.Position = 300;
                GConfSchemas.PlaylistSeparatorPositionSchema.Set (
                    feed_playlist_pane.Position
                );
            }

            update_button = new ActionButton (Globals.ActionManager ["PodcastUpdateFeedsAction"]);
            viewWidget = feed_playlist_pane;

            viewWidget.ShowAll ();
        }
Exemple #47
0
        private void InnerUpdate()
        {
            if (source == null || source.CurrentMessage == null || source.CurrentMessage.IsHidden) {
                Hide ();
                return;
            }

            Message = source.CurrentMessage.Text;
            Pixbuf = null;
            ShowCloseButton = source.CurrentMessage.CanClose;
            Spinning = source.CurrentMessage.IsSpinning;

            Pixbuf = source.CurrentMessage.IconNames == null ? null :
                IconThemeUtils.LoadIcon (22, source.CurrentMessage.IconNames);

            ClearButtons ();

            foreach (MessageAction action in source.CurrentMessage.Actions) {
                Button button = new ActionButton (action);
                button.UseStock = action.IsStock;
                AddButton (button);
            }

            Show ();
        }
		private void AddToRow3(ActionButton button, int column)
		{
			_actionButtonLayoutPanel.Controls.Add(button, column, 3);
		}
Exemple #49
0
        public static bool IsPressedRepeatable(ActionButton button)
        {
            KeyBinding bind = keyBindings[(int)button];

            return IsPressedRepeatable(bind);
        }
 public void SetUIAction(ActionButton _button)
 {
     m_CurrentUIAction = _button.Action;
 }
Exemple #51
0
 public static bool IsPressedMovement(ActionButton button)
 {
     KeyBinding bind = keyBindings[(int)button];
     return IsPressedMovement(bind);
 }
Exemple #52
0
        private void Main_Load(object sender, EventArgs e)
        {
            uploadForm = new Upload();

            //init form options
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);

            this.MouseWheel += new MouseEventHandler(Main_MouseWheel);

            this.DragEnter += Main_DragEnter;
            this.DragDrop += Main_DragDrop;

            //init fonts
            zoomDisplayFont = new Font(FontFamily.GenericSansSerif, 13);

            infoFont = new Font("Candara", 12, FontStyle.Bold);
            if (infoFont.Name != "Candara")
                infoFont = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);

            //init star-related stuff
            starred = new List<string>();

            pathLineH = TextRenderer.MeasureText("Asdf", infoFont).Height;

            //generate other UI images & brushes
            texture = genCheckeredPattern();
            xButton = genXButton();
            xpndButton = genAltCloseButton("expand");
            exitTessModeButton = genAltCloseButton("contract");

            yellowStar = Bitmap.FromFile(Application.StartupPath + "\\icons\\yellow star.png");
            yellowStarButton = Bitmap.FromFile(Application.StartupPath + "\\icons\\yellow star button.png");
            blackStar = Bitmap.FromFile(Application.StartupPath + "\\icons\\black star.png");
            miniStar = Bitmap.FromFile(Application.StartupPath + "\\icons\\mini star.png");

            thumbStripBrush = new SolidBrush(Color.FromArgb(38, 39, 37));

            //init UI buttons
            buttons = new UIButton[15];
            int i = 0;

            buttons[i++] = new UIButton("Tesserax Mode", genButton("tesserax"), -264, tesserax);
            buttons[i++] = new UIButton("Locate on Disk", genButton("locate"), -214, locateOnDisk);
            buttons[i++] = new UIButton("Zoom In", genButton("zoom"), -170, zoomIn);
            buttons[i++] = new UIButton("Zoom Out", genButton("unzoom"), -150, zoomOut);
            buttons[i++] = new UIButton("Toggle Zoom", genButton("zoom toggle"), -130, zoomToggle);
            buttons[i++] = new UIButton("Previous Picture", genButton("prev"), -102, prev);
            buttons[i++] = new UIButton("Play Slideshow", genPlayButton(), -66, play);
            buttons[i++] = new UIButton("Next Picture", genButton("next"), 70, next);
            buttons[i++] = new UIButton("Rotate Counter-Clockwise", genButton("rotate ccw"), 114, rotateCCW);
            buttons[i++] = new UIButton("Rotate Clockwise", genButton("rotate cw"), 134, rotateCW);
            buttons[i++] = new UIButton("Star", genButton("star"), 162, star);
            buttons[i++] = new UIButton("Star All", genButton("star all"), 198, starAll);
            buttons[i++] = new UIButton("Star None", genButton("star none"), 234, starNone);
            buttons[i++] = new UIButton("Comic Book Mode", genButton("comicbook"), 284, comicbook);
            buttons[i++] = new UIButton("About Tesserax", genButton("about"), 334, about);

            sideButtons = new ActionButton[8];
            i = 0;
            sideButtons[i++] = new ActionButton("Copy", genButton("copy"), -(i - 1) * 40, copy);
            sideButtons[i++] = new ActionButton("Delete", genButton("delete"), -(i - 1) * 40, delete);
            sideButtons[i++] = new ActionButton("Edit in Paint", genButton("edit"), -8 - (i - 1) * 40, edit);
            sideButtons[i++] = new ActionButton("Edit in Pixlr", genButton("pixlr"), -8 - (i - 1) * 40, pixlr);
            sideButtons[i++] = new ActionButton("Upload to Imgur", genButton("upload"), -16 - (i - 1) * 40, upload);
            sideButtons[i++] = new ActionButton("Google Search by Image", genButton("google"), -16 - (i - 1) * 40, google);
            sideButtons[i++] = new ActionButton("Search Karma Decay", genButton("karma"), -16 - (i - 1) * 40, karma);
            sideButtons[i++] = new ActionButton("Post to Reddit", genButton("reddit"), -16 - (i - 1) * 40, reddit);

            //prepare background workers
            imgLoader = new BackgroundWorker();
            imgLoader.WorkerSupportsCancellation = true;
            imgLoader.DoWork += new DoWorkEventHandler(imgLoader_DoWork);
            imgLoader.RunWorkerCompleted += new RunWorkerCompletedEventHandler(imgLoader_RunWorkerCompleted);

            assignThumbAndGifLoaders();

            //check for updates
            Updater.Update(VERSION, UPDATE_URL);
        }
 public void SetActionButton( ActionButton btn )
 {
     //btn.Set( m_record.ActionButtons );
 }
 private void doRitualActionSelection(ActionButton btn)
 {
     if(curRitual != RitualObjectId.NONE)
     {
         if(UIManager.Instance.TrySelectRitualAction(btn, curPlayer))
         {
             Debug.Log(String.Format("Ritual for player {0} successful", curPlayer));
         }
         else
         {
             Debug.Log(String.Format("Ritual for player {0} failed", curPlayer));
         }
     }
     else
     {
         Debug.Log(String.Format("Player={0}  Ritual={1} . Either one not set", curPlayer, curRitual));
     }
 }