Ejemplo n.º 1
0
 void SendButtonMessage(ButtonInfo _button)
 {
     if (_button.callbackTarget != null)
     {
         _button.callbackTarget.SendMessage(_button.callback);
     }
 }
Ejemplo n.º 2
0
    /**
     * RayCast管理用メソッド
     */
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        // 左クリック時
        {
            // メインカメラ上のマウス位置からRayをとばす
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, Mathf.Infinity))
            // Raycastの当たり判定
            {
                GameObject obj  = hit.collider.gameObject;          // Raycast衝突オブジェクト取得
                ButtonInfo info = obj.GetComponent <ButtonInfo>();  // ButtonInfoインターフェースを備えたコンポーネント(Script)の実体を取得①

                if (info != null)
                {
                    this.stopWatch.Alternate();
                    StayDataEditor.UpdateStayTime(this.prefabName, this.stopWatch.GetTime());
                    this.stopWatch.ResetStopWatch();

                    this.prefabName = info.GetNextPrefabName();       // ①から遷移先プレハブ名を取得
                    float y = info.GetRotateY();                      // ①から遷移後の水平カメラ回転角度を取得

                    this.animation.Play(this.fadeoutAnimationState.name);

                    this.camera.CameraRotateY(y);                       // カメラ回転
                    this.prefabManager.ChangePrefab(this.prefabName);   // 指定名称を持つプレハブをロード

                    this.animation.Play(this.fadeinAnimationState.name);

                    this.stopWatch.Alternate();
                }
            }
        }
    }
        public DigitalListSettingsControl()
        {
            InitializeComponent();
            Text      = "Info";
            BarButton = new ButtonInfo
            {
                Logo    = BusinessObjects.Instance.ImageResourcesManager.DigitalRetractableBarListImage ?? Properties.Resources.DigitalSettingsList,
                Tooltip = String.Format("Open {0} Schedule Settings",
                                        MediaMetaData.Instance.DataTypeString),
                Action = () => { TabControl.SelectedTabPage = this; }
            };

            buttonXDimensions.Text = DigitalControlsConfiguration.WrapTitle(ListManager.Instance.DefaultControlsConfiguration.ListSettingsDimensionTitle ?? buttonXDimensions.Text);
            buttonXRichMedia.Text  = DigitalControlsConfiguration.WrapTitle(ListManager.Instance.DefaultControlsConfiguration.ListSettingsRichMediaTitle ?? buttonXRichMedia.Text);
            buttonXStrategy.Text   = DigitalControlsConfiguration.WrapTitle(ListManager.Instance.DefaultControlsConfiguration.ListSettingsStrategyTitle ?? buttonXStrategy.Text);
            buttonXLocation.Text   = DigitalControlsConfiguration.WrapTitle(ListManager.Instance.DefaultControlsConfiguration.ListSettingsLocationTitle ?? buttonXLocation.Text);
            buttonXTargeting.Text  = DigitalControlsConfiguration.WrapTitle(ListManager.Instance.DefaultControlsConfiguration.ListSettingsTargetingTitle ?? buttonXTargeting.Text);

            var scaleFactor = Utilities.GetScaleFactor(CreateGraphics().DpiX);

            layoutControlItemDimensions.MaxSize = RectangleHelper.ScaleSize(layoutControlItemDimensions.MaxSize, scaleFactor);
            layoutControlItemDimensions.MinSize = RectangleHelper.ScaleSize(layoutControlItemDimensions.MinSize, scaleFactor);
            layoutControlItemRichMedia.MaxSize  = RectangleHelper.ScaleSize(layoutControlItemRichMedia.MaxSize, scaleFactor);
            layoutControlItemRichMedia.MinSize  = RectangleHelper.ScaleSize(layoutControlItemRichMedia.MinSize, scaleFactor);
            layoutControlItemStrategy.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemStrategy.MaxSize, scaleFactor);
            layoutControlItemStrategy.MinSize   = RectangleHelper.ScaleSize(layoutControlItemStrategy.MinSize, scaleFactor);
            layoutControlItemLocation.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemLocation.MaxSize, scaleFactor);
            layoutControlItemLocation.MinSize   = RectangleHelper.ScaleSize(layoutControlItemLocation.MinSize, scaleFactor);
            layoutControlItemTargeting.MaxSize  = RectangleHelper.ScaleSize(layoutControlItemTargeting.MaxSize, scaleFactor);
            layoutControlItemTargeting.MinSize  = RectangleHelper.ScaleSize(layoutControlItemTargeting.MinSize, scaleFactor);
        }
        private void OnSceneGUI()
        {
            // Only display on selection
            if (Selection.activeObject != button.gameObject)
            {
                return;
            }

            if (!VisiblePlanes)
            {
                return;
            }

            // If the button is being pressed, don't gather new info
            // Just display the info we already gathered
            // This lets people view button presses in real-time
            if (button.IsTouching)
            {
                DrawButtonInfo(currentInfo, false);
            }
            else
            {
                currentInfo = GatherCurrentInfo();
                DrawButtonInfo(currentInfo, EditingEnabled);
            }
        }
        private ButtonInfo GatherCurrentInfo()
        {
            ButtonInfo info = new ButtonInfo();

            info.TouchCageLocalBounds = new Bounds(touchCage.center, touchCage.size);
            // Get the start pos for touch
            Vector3 touchStartOrigin = info.TouchCageLocalBounds.center;

            touchStartOrigin.z   -= info.TouchCageLocalBounds.extents.z;
            info.TouchStartOrigin = touchStartOrigin;
            info.TouchCageCenter  = info.TouchCageLocalBounds.center.z;
            info.TouchCageSize    = info.TouchCageLocalBounds.size.z;

            // Get the start and end pos for moving content
            info.StartPos = buttonContentTransform.localPosition.z;
            info.EndPos   = buttonContentTransform.localPosition.z;
            info.EndPos  += maxPushDistance.floatValue / transform.lossyScale.z;

            info.MaxPushDistance      = maxPushDistance.floatValue;
            info.PressDistance        = pressDistance.floatValue;
            info.ReleaseDistanceDelta = releaseDistanceDelta.floatValue;

            info.PressDistPos   = info.StartPos + (info.PressDistance / transform.lossyScale.z);
            info.TouchStartPos  = info.TouchStartOrigin.z;
            info.ReleaseDistPos = info.PressDistPos - (info.ReleaseDistanceDelta / transform.lossyScale.z);

            return(info);
        }
Ejemplo n.º 6
0
    public override void Draw()
    {
        float centerX       = Screen.width / 2.0f;
        float buttonsHeight = 0.0f;

        foreach (ButtonInfo info in buttons)
        {
            buttonsHeight += info.texture.height + info.bottomPadding;
        }

        float currentY = (Screen.height / 2.0f) - (buttonsHeight / 2.0f);

        for (int i = 0; i < buttons.Length; i++)
        {
            ButtonInfo buttonInfo = buttons[i];
            Texture2D  texture    = buttonInfo.texture;

            GUI.backgroundColor = buttonInfo.color;
            Rect buttonRect = new Rect(centerX - (texture.width / 2.0f), currentY, texture.width, texture.height);
            if (GUI.Button(buttonRect, texture))
            {
                ButtonPressed(buttonInfo.buttonName);
            }
            if (currentHoveredOver != i && buttonRect.Contains(Input.mousePosition))
            {
                currentHoveredOver = i;
                ButtonHover();
            }
            else if (currentHoveredOver == i && !buttonRect.Contains(Input.mousePosition))
            {
                currentHoveredOver = -1;
            }
            currentY += texture.height + buttonInfo.bottomPadding;
        }
    }
Ejemplo n.º 7
0
        public virtual void OnMessage(Message message, UserData userData)
        {
            if (Layout.LayoutType != EButtonType.Usual)
            {
                return;
            }

            ButtonInfo bi = Layout.GetAllButtons().FirstOrDefault(b => b.Text == message.Text);

            if (bi is null)
            {
                OnUnusualMessage(message, userData);
            }
            else
            {
                bi.Action(this, new ButtonActionEventArgs()
                {
                    ButtonClickType = EButtonType.Usual,
                    Data            = bi.Data,
                    MenuController  = message.Controller,
                    User            = message.Recipient,
                    UserData        = userData
                });
            }
        }
Ejemplo n.º 8
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button to mark
            this.markButton                = new ButtonInfo();
            this.markButton.Caption        = "Mark for Review";
            this.markButton.Image          = null;
            this.markButton.OnClick       += this.MarkInvoke;
            this.markButton.OnRefresh     += this.Refresh;
            this.markButton.ToolBarVisible = true;
            this.markButton.ToolTip        = "Marks item for later review";
            this.markButton.ShortcutKeys   = Keys.Control | Keys.M;
            this.markButton.Context        = PluginContext.LocalResourceItem.ToString(); // this plug in can be invoke when a resouce item is selected
            this.context.AddButton(this.markButton);

            // create the button to unmark
            this.unmarkButton                = new ButtonInfo();
            this.unmarkButton.Caption        = "Unmark for Review";
            this.unmarkButton.Image          = null;
            this.unmarkButton.OnClick       += this.UnmarkInvoke;
            this.unmarkButton.OnRefresh     += this.Refresh;
            this.unmarkButton.ToolBarVisible = true;
            this.unmarkButton.ToolTip        = "Unmarks item for later review";
            this.unmarkButton.ShortcutKeys   = Keys.Control | Keys.U;
            this.unmarkButton.Context        = PluginContext.LocalResourceItem.ToString(); // this plug in can be invoke when a resouce item is selected
            this.context.AddButton(this.unmarkButton);
        }
        private void OnSceneGUI()
        {
            if (touchable == null)
            {
                // The inspector code will prompt a developer to add a touchable.
                return;
            }

            if (!VisiblePlanes)
            {
                return;
            }

            // If the button is being pressed, don't gather new info
            // Just display the info we already gathered
            // This lets people view button presses in real-time
            if (button.IsTouching)
            {
                DrawButtonInfo(currentInfo, false);
            }
            else
            {
                currentInfo = GatherCurrentInfo();
                DrawButtonInfo(currentInfo, EditingEnabled);
            }
        }
Ejemplo n.º 10
0
 public ViewResultBase Details()
 {
     if (!string.IsNullOrEmpty(Request["isTooltip"]))
     {
         Guid id;
         if (Guid.TryParse(Request["id"], out id))
         {
             var data = ButtonInfo.Create(base.EntityType.GetData(id));
             return(new PartialViewResult {
                 ViewName = "Partials/Details", ViewData = new ViewDataDictionary(data)
             });
         }
         else
         {
             throw new ValidationException("非法的Guid标识" + Request["id"]);
         }
     }
     else if (!string.IsNullOrEmpty(Request["isInner"]))
     {
         return(new PartialViewResult {
             ViewName = "Partials/Details"
         });
     }
     else
     {
         return(this.View());
     }
 }
Ejemplo n.º 11
0
    private InteractableButton GetButton(ButtonInfo buttonData)
    {
        InteractableButton interactable = null;

        switch (buttonData.Type)
        {
        case ButtonType.BUTTON:
        {
            interactable = clickButtonFactory.Create();
        }
        break;

        case ButtonType.TOGGLE:
        {
            interactable = toggleButtonFactory.Create();
        }
        break;

        case ButtonType.SLIDER:
        {
            interactable = toggleButtonFactory.Create();
        }
        break;

        default:
            break;
        }
        interactable?.SetButtonData(buttonData);
        return(interactable);
    }
Ejemplo n.º 12
0
		public NormalPage( string mainText, params string[] buttonTexts ) {
			this.mainText = mainText;
			buttons = new ButtonInfo[ buttonTexts.Length ];
			for( int i = 0; i < buttons.Length; ++i ) {
				buttons[ i ] = new ButtonInfo( buttonTexts[ i ] );
			}
		}
Ejemplo n.º 13
0
        private void InternalLeftButtonClick(ButtonInfo info)
        {
            if (info.Button.CurrentCellType == CellType.Button)
            {
                if (CellDataProvider[info.X, info.Y])
                {
                    info.Button.SetType(CellType.BombExplode);
                    CellDataProvider.EndTypeUpdated(EndType.YouHaveLost, 0);
                }
                else
                {
                    info.Button.SetType(CellType.Empty);
                    int bombsNear = GetBombsAround(info.X, info.Y, (x, y) => CellDataProvider[x, y]);
                    if (bombsNear == 0)
                    {
                        var marked = new HashSet <ButtonInfo>();
                        MarkEmptyAround(info, marked);
                    }
                    else
                    {
                        info.Button.SetType((CellType)Enum.Parse(typeof(CellType), $"Near{bombsNear}"));
                    }
                }
            }

            CheckGameStatus();
        }
Ejemplo n.º 14
0
        private GameObject CreateButton(
            GameObject prefab,
            string name,
            UIAnchor anchor,
            UIPivot pivot,
            Vector2 offset,
            out ButtonInfo buttonInfo)
        {
            buttonInfo = (ButtonInfo)null;
            if (Object.op_Equality((Object)prefab, (Object)null))
            {
                return((GameObject)null);
            }
            GameObject gameObject = UITools.InstantiateGUIObject <ButtonInfo>(prefab, this.content.get_transform(), name, UIPivot.op_Implicit(pivot), (Vector2)anchor.min, (Vector2)anchor.max, offset);

            if (Object.op_Equality((Object)gameObject, (Object)null))
            {
                return((GameObject)null);
            }
            buttonInfo = (ButtonInfo)gameObject.GetComponent <ButtonInfo>();
            if (Object.op_Equality((Object)gameObject.GetComponent <Button>(), (Object)null))
            {
                Debug.Log((object)"Button prefab is missing Button component!");
                return((GameObject)null);
            }
            if (!Object.op_Equality((Object)buttonInfo, (Object)null))
            {
                return(gameObject);
            }
            Debug.Log((object)"Button prefab is missing ButtonInfo component!");
            return((GameObject)null);
        }
Ejemplo n.º 15
0
    public void OnProductButtonClicked(ButtonInfo info)
    {
        if (Storno.isOn)
        {
            if (info.Count > 0)
            {
                info.Count--;
                info.UpdateText();
                sum -= info.Price;
                Remove(info.Name);
            }
        }
        else
        {
            info.Count++;
            info.UpdateText();
            sum += info.Price;
            Add(info.Name);
        }
        UpdateText();

        BezahltButton.interactable = sum > 0;
        if (AufschreibenButton != null)
        {
            AufschreibenButton.interactable = sum > 0;
        }
    }
Ejemplo n.º 16
0
        private void RemoveHiddenButtons()
        {
            List <Button> hidden = new List <Button>();

            foreach (Button child in SpinnerPanel.Children)
            {
                if (child.Opacity == 0)
                {
                    hidden.Add(child);
                }
                else
                {
                    // force repaint so left over mouse over effects are cleaned up.
                    child.Background = child.Background;
                }
            }

            foreach (Button b in hidden)
            {
                // we keep the ButtonInfo structure around so we can remember the sizes
                // of the buttons which helps us with Layout.
                ButtonInfo info = (ButtonInfo)b.Tag;
                info.Button = null;
                SpinnerPanel.Children.Remove(b);
            }
        }
Ejemplo n.º 17
0
        private void SetRemap(Buttons button)
        {
            remapping  = false;
            inputDelay = 0.25f;
            ButtonInfo info = ButtonInfos[remappingType];

            if (info.GetButton().HasValue&& info.GetButton().Value == button)
            {
                info.SetButton(null);
            }
            else
            {
                info.SetButton(button);
                foreach (ButtonInfo otherInfo in ButtonInfos.Values)
                {
                    if (otherInfo == info)
                    {
                        continue;
                    }
                    if (otherInfo.GetButton().HasValue&& otherInfo.GetButton().Value == button)
                    {
                        otherInfo.SetButton(null);
                        otherInfo.UpdateVirtualButton();
                    }
                }
            }
            info.UpdateVirtualButton();
            Reload(Selection);
        }
Ejemplo n.º 18
0
    /// <summary>
    /// At the start of the program, all of the buttons are instantiated and disactivated.
    /// </summary>
    void Start()
    {
        // Object pool
        pooledButtons = new GameObject[maximumButtonRow, maximumButtonColumn];
        GameObject button;

        for (int i = 0; i < maximumButtonColumn; i++)
        {
            for (int j = 0; j < maximumButtonRow; j++)
            {
                // Instantiate the button
                button      = Instantiate(buttonPrefab, transform);
                button.name = string.Intern(string.Format("({0}, {1})", j + 1, i + 1));

                // Set the coordinates of the button
                ButtonInfo currentButtonInfo = button.GetComponent <ButtonInfo>();
                currentButtonInfo.Coordinates[0] = j + 1;
                currentButtonInfo.Coordinates[1] = i + 1;

                // Disactive
                button.SetActive(false);
                pooledButtons[j, i] = button;
            }
        }
    }
        private bool IsMouseOverQuad(ButtonInfo info, Vector3 halfExtents, Vector3 centerLocal)
        {
            Vector3 mousePosition = Event.current.mousePosition;

            mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y;
            Ray mouseRay = SceneView.currentDrawingSceneView.camera.ScreenPointToRay(mousePosition);

            // Transform to local object space.
            mouseRay.direction = button.transform.InverseTransformDirection(mouseRay.direction);
            mouseRay.origin    = button.transform.InverseTransformPoint(mouseRay.origin);

            // Transform to plane space, which transform the plane into the XY plane.
            Quaternion quadRotationInverse = Quaternion.Inverse(info.PushRotationLocal);

            mouseRay.direction = quadRotationInverse * mouseRay.direction;
            mouseRay.origin    = quadRotationInverse * (mouseRay.origin - centerLocal);

            // Intersect ray with XY plane.
            Plane xyPlane = new Plane(Vector3.forward, 0.0f);
            float intersectionDistance = 0.0f;

            if (xyPlane.Raycast(mouseRay, out intersectionDistance))
            {
                Vector3 intersection = mouseRay.GetPoint(intersectionDistance);
                return(Mathf.Abs(intersection.x) <= halfExtents.x && Mathf.Abs(intersection.y) <= halfExtents.y);
            }

            return(false);
        }
Ejemplo n.º 20
0
        private void SelectButton(ButtonInfo buttonInfo)
        {
            if (this.selection != null)
            {
                Button button = this.selection.Button;
                if (button != null)
                {
                    Brush brush = this.FindResource <Brush>("FocusVisualWhiteStrokeThemeBrush");
                    button.BorderBrush = brush;
                }
            }

            this.selection = buttonInfo;

            if (this.selection != null)
            {
                SelectedDate = buttonInfo.Date;

                Button button = this.selection.Button;
                if (button != null)
                {
                    Brush brush = this.FindResource <Brush>("SelectedVisualStrokeThemeBrush");
                    button.BorderBrush = brush;
                }
            }
        }
Ejemplo n.º 21
0
        private ButtonInfo FindButtonByDate(DateTime date)
        {
            ButtonInfo found = null;

            dateIndex.TryGetValue(date, out found);
            return(found);
        }
Ejemplo n.º 22
0
    KMSelectable.OnInteractHandler GetInteractHandler(KMSelectable selectable, ButtonInfo buttonInfo)
    {
        return(delegate()
        {
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            selectable.AddInteractionPunch(0.5f);
            string Direction = selectable.ToString().Split(' ').First();

            if (!Solved)
            {
                if (buttonInfo.resetButton)
                {
                    CurX = StartX;
                    CurY = StartY;
                    UpdatePosition();
                    ButtonRotation(CurX, CurY);
                    DebugLog("Resetted, now at ({0}, {1})", RotX, RotY);
                    //DebugLog("Resetted, now at ({0}, {1})", CurX + 1, CurY + 1);
                }
                else if (CurrentP.Contains(buttonInfo.invalidDirection))
                {
                    ButtonRotation(CurX, CurY);
                    DebugLog("There is a wall to the {0} at ({1}, {2}). Strike.", Direction, RotX, RotY);
                    //DebugLog("There is a wall at {1}, {2}, and it doesn't match the manual. SOMEone should fix this.", CurX + 1, CurY + 1);
                    BombModule.HandleStrike();
                }
                else
                {
                    UpdatePosition(Direction, buttonInfo.xOffset, buttonInfo.yOffset, true);
                }
            }

            return false;
        });
    }
Ejemplo n.º 23
0
        public SummaryColumnSettingsControl()
        {
            InitializeComponent();
            Text      = "Info";
            BarButton = new ButtonInfo
            {
                Logo    = BusinessObjects.Instance.ImageResourcesManager.SnapshotsRetractableBarSummaryImage ?? Properties.Resources.SectionSettingsInfo,
                Tooltip = "Open Schedule Info",
                Action  = () => { TabControl.SelectedTabPage = this; }
            };

            var scaleFactor = Utilities.GetScaleFactor(CreateGraphics().DpiX);

            layoutControlItemLineId.MaxSize     = RectangleHelper.ScaleSize(layoutControlItemLineId.MaxSize, scaleFactor);
            layoutControlItemLineId.MinSize     = RectangleHelper.ScaleSize(layoutControlItemLineId.MinSize, scaleFactor);
            layoutControlItemLogo.MaxSize       = RectangleHelper.ScaleSize(layoutControlItemLogo.MaxSize, scaleFactor);
            layoutControlItemLogo.MinSize       = RectangleHelper.ScaleSize(layoutControlItemLogo.MinSize, scaleFactor);
            layoutControlItemCampaign.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemCampaign.MaxSize, scaleFactor);
            layoutControlItemCampaign.MinSize   = RectangleHelper.ScaleSize(layoutControlItemCampaign.MinSize, scaleFactor);
            layoutControlItemComments.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemComments.MaxSize, scaleFactor);
            layoutControlItemComments.MinSize   = RectangleHelper.ScaleSize(layoutControlItemComments.MinSize, scaleFactor);
            layoutControlItemSpots.MaxSize      = RectangleHelper.ScaleSize(layoutControlItemSpots.MaxSize, scaleFactor);
            layoutControlItemSpots.MinSize      = RectangleHelper.ScaleSize(layoutControlItemSpots.MinSize, scaleFactor);
            layoutControlItemCost.MaxSize       = RectangleHelper.ScaleSize(layoutControlItemCost.MaxSize, scaleFactor);
            layoutControlItemCost.MinSize       = RectangleHelper.ScaleSize(layoutControlItemCost.MinSize, scaleFactor);
            layoutControlItemTotalWeeks.MaxSize = RectangleHelper.ScaleSize(layoutControlItemTotalWeeks.MaxSize, scaleFactor);
            layoutControlItemTotalWeeks.MinSize = RectangleHelper.ScaleSize(layoutControlItemTotalWeeks.MinSize, scaleFactor);
            layoutControlItemTotalCost.MaxSize  = RectangleHelper.ScaleSize(layoutControlItemTotalCost.MaxSize, scaleFactor);
            layoutControlItemTotalCost.MinSize  = RectangleHelper.ScaleSize(layoutControlItemTotalCost.MinSize, scaleFactor);
            layoutControlItemTallySpots.MaxSize = RectangleHelper.ScaleSize(layoutControlItemTallySpots.MaxSize, scaleFactor);
            layoutControlItemTallySpots.MinSize = RectangleHelper.ScaleSize(layoutControlItemTallySpots.MinSize, scaleFactor);
            layoutControlItemTallyCost.MaxSize  = RectangleHelper.ScaleSize(layoutControlItemTallyCost.MaxSize, scaleFactor);
            layoutControlItemTallyCost.MinSize  = RectangleHelper.ScaleSize(layoutControlItemTallyCost.MinSize, scaleFactor);
        }
Ejemplo n.º 24
0
    /// <summary>
    /// Checks if the path is ready to be found.
    /// </summary>
    private void CheckIfPathReady()
    {
        if (StartNode != null && GoalNode != null)
        {
            // Pathfinding
            List <ButtonNode> pathNodes = pathfinder.FindPath();

            // If the path is found
            if (!(pathNodes is null))
            {
                // Set up the path buttons
                for (int i = 0; i < pathNodes.Count; i++)
                {
                    ButtonInfo pathButton = ButtonPool.sharedInstance.GetPooledButton(pathNodes[i].X - 1, pathNodes[i].Y - 1);
                    pathButton.IsPath(true, pathNodes[i].DistanceFromStart);
                    pathButtons.Add(pathButton);
                }

                // Adjust the text of the start and goal buttons
                StartNode.AddDistanceText(0);
                int goalNodeDistance = pathNodes[0].DistanceFromStart + 1;
                GoalNode.AddDistanceText(goalNodeDistance);
            }
            else
            {
                Debug.Log("Could not find a path to the goal.");
            }
        }
        public void Update(Package package)
        {
            // Local variable because it's used in Layoutsubviews
            this.package = package;

            nameLabel.Text = package.Name;

            statusLabel.Text = package.GetStatusText();

            ButtonInfo info = package.GetButtonInfo();

            Button.Text          = info.Text;
            Button.Type          = info.Type;
            Button.PriorityIndex = info.PriorityIndex;
            Button.PackageName   = info.PackageName;
            Button.PackageId     = info.PackageId;

            if (Button.Type == PMButtonType.UpdatePackages)
            {
                Button.Font = UIFont.FromName("HelveticaNeue-Bold", 14);
            }
            else
            {
                Button.Font = UIFont.FromName("HelveticaNeue-Light", 12);
            }
        }
Ejemplo n.º 26
0
        public SectionTotalsSettingsControl()
        {
            InitializeComponent();

            Text      = "Info";
            BarButton = new ButtonInfo
            {
                Logo    = BusinessObjects.Instance.ImageResourcesManager.ProgramScheduleRetractableBarTotalsImage ?? Properties.Resources.SectionSettingsInfo,
                Tooltip = "Open Schedule Info",
                Action  = () => { TabControl.SelectedTabPage = this; }
            };

            quarterSelectorControl.QuarterSelected += OnQuarterChanged;

            var scaleFactor = Utilities.GetScaleFactor(CreateGraphics().DpiX);

            layoutControlItemAvgRate.MaxSize      = RectangleHelper.ScaleSize(layoutControlItemAvgRate.MaxSize, scaleFactor);
            layoutControlItemAvgRate.MinSize      = RectangleHelper.ScaleSize(layoutControlItemAvgRate.MinSize, scaleFactor);
            layoutControlItemDiscount.MaxSize     = RectangleHelper.ScaleSize(layoutControlItemDiscount.MaxSize, scaleFactor);
            layoutControlItemDiscount.MinSize     = RectangleHelper.ScaleSize(layoutControlItemDiscount.MinSize, scaleFactor);
            layoutControlItemNetRate.MaxSize      = RectangleHelper.ScaleSize(layoutControlItemNetRate.MaxSize, scaleFactor);
            layoutControlItemNetRate.MinSize      = RectangleHelper.ScaleSize(layoutControlItemNetRate.MinSize, scaleFactor);
            layoutControlItemTotalCPP.MaxSize     = RectangleHelper.ScaleSize(layoutControlItemTotalCPP.MaxSize, scaleFactor);
            layoutControlItemTotalCPP.MinSize     = RectangleHelper.ScaleSize(layoutControlItemTotalCPP.MinSize, scaleFactor);
            layoutControlItemTotalCost.MaxSize    = RectangleHelper.ScaleSize(layoutControlItemTotalCost.MaxSize, scaleFactor);
            layoutControlItemTotalCost.MinSize    = RectangleHelper.ScaleSize(layoutControlItemTotalCost.MinSize, scaleFactor);
            layoutControlItemTotalPeriods.MaxSize = RectangleHelper.ScaleSize(layoutControlItemTotalPeriods.MaxSize, scaleFactor);
            layoutControlItemTotalPeriods.MinSize = RectangleHelper.ScaleSize(layoutControlItemTotalPeriods.MinSize, scaleFactor);
            layoutControlItemTotalSpots.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemTotalSpots.MaxSize, scaleFactor);
            layoutControlItemTotalSpots.MinSize   = RectangleHelper.ScaleSize(layoutControlItemTotalSpots.MinSize, scaleFactor);
            layoutControlItemTotalGRP.MaxSize     = RectangleHelper.ScaleSize(layoutControlItemTotalGRP.MaxSize, scaleFactor);
            layoutControlItemTotalGRP.MinSize     = RectangleHelper.ScaleSize(layoutControlItemTotalGRP.MinSize, scaleFactor);
        }
Ejemplo n.º 27
0
        private void OnSubExpressionButtonClick(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            ButtonInfo buttonInfo = (ButtonInfo)button.Tag;

            if (!highlightedAreas.ContainsKey(buttonInfo.toHighlight))
            {
                this.highlightedAreas.Add(buttonInfo.toHighlight, Brushes.Yellow);
            }

            Rectangle toInvalidate = Rectangle.Truncate(buttonInfo.toHighlight);

            toInvalidate.Height += 1;
            toInvalidate.Width  += 1;
            this.Invalidate(toInvalidate);

            foreach (ToolStripItem item in sharedContextMenu.Items)
            {
                if (item is ToolStripTextBox)
                {
                    ((ToolStripTextBox)item).Control.Parent.Controls.Remove(((ToolStripTextBox)item).Control);
                }
            }

            this.sharedContextMenu.Items.Clear();

            this.sharedContextMenu.Items.AddRange(ButtonAndMenuData.GetMenuItems(buttonInfo.associatedExpression).ToArray());

            this.sharedContextMenu.Show(this.PointToScreen(new Point(button.Right, button.Bottom)), ToolStripDropDownDirection.AboveRight);
        }
Ejemplo n.º 28
0
 protected override void OnPrefabInit()
 {
     keepMenuOpen = true;
     base.OnPrefabInit();
     if (!GenericGameSettings.instance.demoMode)
     {
         buttons = new ButtonInfo[8]
         {
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.RESUME, Action.NumActions, OnResume, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.SAVE, Action.NumActions, OnSave, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.SAVEAS, Action.NumActions, OnSaveAs, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.LOAD, Action.NumActions, OnLoad, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.OPTIONS, Action.NumActions, OnOptions, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.COLONY_SUMMARY, Action.NumActions, OnColonySummary, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.QUIT, Action.NumActions, OnQuit, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.DESKTOPQUIT, Action.NumActions, OnDesktopQuit, null, null)
         };
     }
     else
     {
         buttons = new ButtonInfo[4]
         {
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.RESUME, Action.NumActions, OnResume, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.OPTIONS, Action.NumActions, OnOptions, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.QUIT, Action.NumActions, OnQuit, null, null),
             new ButtonInfo(UI.FRONTEND.PAUSE_SCREEN.DESKTOPQUIT, Action.NumActions, OnDesktopQuit, null, null)
         };
     }
     closeButton.onClick += OnResume;
     instance             = this;
     Show(false);
 }
        public FrameworkElement ResolveEditor(PropertyItem propertyItem)
        {
            var editor = new ButtonEdit();
            var button = new ButtonInfo {GlyphKind = GlyphKind.User };

            button.Click += (s, e) => OnCopyValue(editor);
            button.Content = new Image
            {
                Source = Properties.Resources.Clipboard.ToBitmapImage(), 
                Width = 16, 
                Height = 16,
                Stretch = Stretch.Uniform
            };

            editor.Buttons.Add(button);
            editor.AllowDefaultButton = false;
            editor.ShowBorder = false;
            editor.IsReadOnly = false;
            editor.Mask = GetDisplayFormat(propertyItem);
            editor.MaskType = GetMaskType(propertyItem);
            editor.MaskUseAsDisplayFormat = true;
            editor.EditMode = EditMode.Standalone;
            editor.Background = Brushes.Transparent;
            editor.TextWrapping = TextWrapping.NoWrap;
            editor.TextTrimming = TextTrimming.WordEllipsis;

            var binding = new Binding("Value");
            binding.Source = propertyItem;
            binding.ValidatesOnExceptions = true;
            binding.ValidatesOnDataErrors = true;
            binding.Mode = BindingMode.OneWay;
            BindingOperations.SetBinding(editor, BaseEdit.EditValueProperty, binding);

            return editor;
        }
Ejemplo n.º 30
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button that will invoke adding items
            this.addButton                = new ButtonInfo();
            this.addButton.Caption        = "Add Resource Item";
            this.addButton.Image          = Properties.Resources.resStringAdd;
            this.addButton.OnClick       += this.AddButton_Click;
            this.addButton.ToolBarVisible = false;
            this.addButton.ToolTip        = "Adds a new resource item to the current resource bundle";
            this.addButton.Context        = PluginContext.ResourceSet.ToString(); // this button can be pressed when a local resource set is loaded/selected
            this.context.AddButton(this.addButton);

            // create the button that will invoke removing items
            this.removeButton                = new ButtonInfo();
            this.removeButton.Caption        = "Remove Resource Item";
            this.removeButton.Image          = Properties.Resources.resStringDel;
            this.removeButton.OnClick       += this.RemoveButton_Click;
            this.removeButton.ToolBarVisible = false;
            this.removeButton.ToolTip        = "Removes selected resource item from the current resource bundle";
            this.removeButton.Context        = PluginContext.ResourceItem.ToString(); // this button can be pressed when a row is selected on editing grid
            this.context.AddButton(this.removeButton);

            // create the button that will invoke editing items
            this.editButton                = new ButtonInfo();
            this.editButton.Caption        = "Edit Resource Item";
            this.editButton.OnClick       += this.EditButton_Click;
            this.editButton.ToolBarVisible = false;
            this.editButton.ToolTip        = "Edits selected resource item";
            this.editButton.Context        = PluginContext.ResourceItem.ToString(); // this button can be pressed when a row is selected on editing grid
            this.context.AddButton(this.editButton);
        }
    public void setUpButtonLayout(GameObject button)
    {
        ButtonInfo buttonInfo = button.GetComponent <ButtonInfo>();
        Vector2    pos        = buttonInfo.PositionOnSphere;
        Vector2    size       = buttonInfo.ButtonSize;

        //calculate the button's center angle on sphere
        //It will be the mean off all the occupy grid
        List <Vector2> angleList = new List <Vector2>();

        for (int i = 0; i < size.y; i++)
        {
            for (int j = 0; j < size.x; j++)
            {
                Vector2 angle = Vector2.zero;

                angle.x = pos.x * buttonAngle;
                angle.y = pos.y * buttonAngle;

                angleList.Add(angle);
            }
        }
        Vector2 buttonCenter = LayoutCalculator.meanAngle(angleList);

        //calculate button length
        float width  = size.x * buttonLength;
        float height = size.y * buttonLength;

        //Setup the button
        button.GetComponent <ButtonCurvedEffect>().setButton(buttonManager.gameObject, width, height, buttonCenter.y + VerticalAngle, buttonCenter.x + HorizontalAngle + forwardAngle);
    }
Ejemplo n.º 32
0
        /// <summary>
        /// 添加/编辑按钮
        /// pxd 2015-09-23
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string AddOrEditButton(ButtonInfo model)
        {
            string strReturn = "";

            try
            {
                if (model.BtnID == 0)  //新增
                {
                    if (!Add(null, model))
                    {
                        strReturn = ErrorPrompt.AddError;
                    }
                }
                else  //编辑
                {
                    if (!Update(null, model))
                    {
                        strReturn = ErrorPrompt.UpdateError;
                    }
                }
            }
            catch (Exception ex)
            {
                strReturn = ex.Message.ToString();
            }

            return(strReturn);
        }
Ejemplo n.º 33
0
 public void OnButtonActivated(ButtonInfo buttonInfo)
 {
     if (this.inputFieldActivatedCallback == null)
     {
         return;
     }
     this.inputFieldActivatedCallback(this.rowIndex, buttonInfo);
 }
Ejemplo n.º 34
0
        public void AddTaskButton(ButtonInfo bi)
        {
            var button = new Button();
            button.Width = SIZE;
            button.Height = SIZE;
            button.Text = bi.Title;
            button.Left =
                Buttons.Count > 0 ? Buttons.Max(s => s.Left + s.Width + MARGIN) : 0;
            button.Top = MARGIN;
            Container.Controls.Add(button);

            button.Click += (sender, args) => ExecuteTask(bi.Task);

            Buttons.Add(button);
        }
Ejemplo n.º 35
0
        //JL : duplicate with MouseCodeFromButtonInfo in BasicScroll/Editor/EditorViewModel.cs. Where can it be put to avoid duplication ?
        public int MouseCodeFromButtonInfo( ButtonInfo buttonInfo, string extraInfo )
        {
            if( buttonInfo == ButtonInfo.DefaultButton )
            {
                return 1;
            }

            if( buttonInfo == ButtonInfo.XButton )
            {
                if( extraInfo == "Right" )
                    return 2;

                if( extraInfo == "Middle" )
                    return 3;
            }

            return 0;
        }
Ejemplo n.º 36
0
    /// <summary>
    /// 角色界面中装备被点时
    /// </summary>
    /// <param name="_typeId"></param>
    public void OnEquipGridUp(int _typeId)
    {
        if (!m_itemsOnEquip.ContainsKey(_typeId))
            return;
        LoggerHelper.Debug("OnEquipGridUp:" + _typeId);
        ItemEquipment item = m_itemsOnEquip[_typeId];
        m_selectedItem = item;

        List<ButtonInfo> btnList = new List<ButtonInfo>();
        ButtonInfo btn;

        if (item.enchant != null && item.enchant.Count > 0)
        {
            btn = new ButtonInfo()
            {
                action = () => { OnFumo(_typeId); },
                text = LanguageData.GetContent(1349),
                id = 1349
            };
            btnList.Add(btn);
        }

        btn = new ButtonInfo() { action = ShowItem, text = LanguageData.GetContent(903), id = 903 };
        btnList.Add(btn);

        btn = new ButtonInfo() { action = EquipToInsetJewel, text = LanguageData.GetContent(905), id = 905 };
        btnList.Add(btn);

        btn = new ButtonInfo() { action = StrengthEquip, text = LanguageData.GetContent(907), id = 907 };
        btnList.Add(btn);

        //ButtonInfo btn3 = new ButtonInfo() { action = OnRemoveEquip, text = "卸下" };
        //if (EquipUpgradeManager.Instance.CanUpgrade(item))
        //{
        //    //Debug.LogError(item.effectId);
        //    btn = new ButtonInfo() { action = OnUpGragdeEquip, text = LanguageData.GetContent(902), id = 902 };
        //    btnList.Add(btn);
        //}
        //btnList.Add(btn3);

        ShowEquipTip(item, btnList, MogoWorld.thePlayer.level, true, _typeId);
        //ShowEquipInfo(item);
    }
Ejemplo n.º 37
0
 void ShowAnimationButtons(ButtonInfo[] infos, float buttonHeight)
 {
     foreach (var tmpInfo in infos) {
         if ( GUILayout.Button(tmpInfo.buttonLabel, GUILayout.Height(buttonHeight)) ){
             ChangeAnimation(tmpInfo.id);
         }
     }
 }
Ejemplo n.º 38
0
    private void ShowPropTip(ItemParent item)
    {
        ItemMaterial material = (ItemMaterial)item;

        string stack = "";
        if (material.maxStack > 1)
        {
            stack = material.stack + "/" + material.maxStack + "";
            //view.SetPropTipStack(material.stack + "/" + material.maxStack + "");
        }

        List<ButtonInfo> btnList = new List<ButtonInfo>();
        ButtonInfo btn;
        if (CanMaterialExchangeEquip(item))
        {
            btn = new ButtonInfo() { action = () => { OnExchangeEquip(item); }, id = 899, text = LanguageData.GetContent(899) };
            btnList.Add(btn);
        }

        //激活套装材料
        if (item.type == 8)
        {
            btn = new ButtonInfo() { action = () => { OnActivate(item); }, id = 899, text = LanguageData.GetContent(899) };
            btnList.Add(btn);
        }

        if (material.effectId > 0 && material.type != 8)
        {
            btn = new ButtonInfo() { action = OnPropUse, text = LanguageData.GetContent(909), id = 909 };
            btnList.Add(btn);
        }
        if (material.price > 0)
        {
            btn = new ButtonInfo() { action = OnMaterialTipSell, text = LanguageData.GetContent(908), id = 908 };
            btnList.Add(btn);
        }

        ShowPropTip(item.templateId, btnList, stack);
    }
Ejemplo n.º 39
0
    private void ShowEquipTipInBag(ItemParent item)
    {
        //显示选中装备tip
        List<ButtonInfo> btnList = new List<ButtonInfo>();
        ButtonInfo btn = new ButtonInfo() { action = OnEquip, text = LanguageData.GetContent(900), id = 900 };
        //显示当前装备tip
        int slot = (item.type == 10 ? 11 : item.type);

        //戒指的情况
        if (item.type == (int)EquipType.Ring)
        {
            if (m_itemsOnEquip.ContainsKey(item.type) && m_itemsOnEquip.ContainsKey(item.type + 1))
            {
                btn.text = LanguageData.GetContent(901);
                btn.id = 901;
                ItemEquipment item1 = m_itemsOnEquip.Get(item.type);
                ItemEquipment item2 = m_itemsOnEquip.Get(item.type + 1);
                ItemEquipment item3 = item1.score < item2.score ? item1 : item2;
                ShowCurrentEquipInfo(item3, MogoWorld.thePlayer.level);
            }
        }
        else//非戒指的情况
        {
            if (m_itemsOnEquip.ContainsKey(slot))
            {
                LoggerHelper.Debug("has equip on:" + m_itemsOnEquip[slot].templateId);
                btn.text = LanguageData.GetContent(901);
                btn.id = 901;
                ShowCurrentEquipInfo(m_itemsOnEquip[slot], MogoWorld.thePlayer.level);
            }
        }

        btnList.Add(btn);

        //Debug.LogError(item.effectId);
        //装备升级
        if (EquipUpgradeManager.Instance.CanUpgrade(item))
        {
            //Debug.LogError(item.effectId);
            btn = new ButtonInfo() { action = OnUpGragdeEquip, text = LanguageData.GetContent(902), id = 902 };
            btnList.Add(btn);
        }


        btn = new ButtonInfo() { action = ShowItem, text = LanguageData.GetContent(903), id = 903 };
        btnList.Add(btn);
        //btn = new ButtonInfo() { action = OnDecompose, text = LanguageData.GetContent(904), id = 904 };
        //btnList.Add(btn);


        ShowEquipTip((ItemEquipment)item, btnList, MogoWorld.thePlayer.level);


        LoggerHelper.Debug("ShowEquipTip done");
    }
Ejemplo n.º 40
0
    /// <summary>
    /// 背包物品被点击后
    /// </summary>
    /// <param name="index"></param>
    private void OnSelectItemInbag(int index)
    {
        if (!m_itemsInBag[CurrentTagIndex].ContainsKey(index)) return;
        ItemParent item = m_itemsInBag[CurrentTagIndex][index];
        m_selectedItem = item;

        switch (CurrentTagIndex)
        {
            case ITEM_TYPE_EQUIPMENT:
                LoggerHelper.Debug("ShowEquipTip");
                if (m_selectedItem.itemType == 1)
                {
                    ShowEquipTipInBag(m_selectedItem);
                }
                else
                {
                    ShowPropTip(m_selectedItem);
                }
                break;
            case ITEM_TYPE_JEWEL:
                List<ButtonInfo> btnList = new List<ButtonInfo>();
                ButtonInfo btn1 = new ButtonInfo() { action = InsetJewel, text = LanguageData.GetContent(905), id = 905 };
                ButtonInfo btn2 = new ButtonInfo() { action = OnCompose, text = LanguageData.GetContent(906), id = 906 };
                btnList.Add(btn1);
                btnList.Add(btn2);
                ShowJewelTip((ItemJewel)m_selectedItem, btnList);
                break;
            case ITEM_TYPE_MATERIAL:
                ShowMaterialTip(m_selectedItem);
                break;
        }

    }
Ejemplo n.º 41
0
    private void ShowMaterialTip(ItemParent item)
    {
        //Debug.LogError("ShowMaterialTip:" + item.id);
        ItemMaterial material = (ItemMaterial)item;

        List<ButtonInfo> btnList = new List<ButtonInfo>();
        ButtonInfo btn;
        if (material.type == 1)
        {
            btn = new ButtonInfo() { action = OnMaterialTipEnhance, text = LanguageData.GetContent(907), id = 907 };
            btnList.Add(btn);
        }
        if (CanMaterialExchangeEquip(item))
        {
            btn = new ButtonInfo() { action = () => { OnExchangeEquip(item); }, id = 899, text = LanguageData.GetContent(899) };
            btnList.Add(btn);
        }
        if (material.price > 0)
        {
            btn = new ButtonInfo() { action = OnMaterialTipSell, text = LanguageData.GetContent(908), id = 908 };
            btnList.Add(btn);
        }

        ShowMaterialTip(material.templateId, btnList, material.stack, material.maxStack);

    }
Ejemplo n.º 42
0
        void NavButtonUnchecked(object sender, RoutedEventArgs e)
        {
            DebugWrite();

            var button = new ButtonInfo(sender);
            button.HamburgerButtonInfo.RaiseUnchecked(e);
            button.Button.IsHitTestVisible = true;
        }
Ejemplo n.º 43
0
 private void NavButton_VisualStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     var button = new ButtonInfo(e.Control);
     switch (e.NewState.Name)
     {
         case "Normal":
         case "PointerOver":
         case "Pressed":
         case "Disabled":
         case "Checked":
         case "CheckedPointerOver":
         case "CheckedPressed":
         case "CheckedDisabled":
         case "Indeterminate":
         case "IndeterminatePointerOver":
         case "IndeterminatePressed":
         case "IndeterminateDisabled":
         default:
             break;
     }
 }
Ejemplo n.º 44
0
 private void CreateButtons(ButtonInfo[] buttons, byte num)
 {
     for (var cnt = 0; cnt < num; cnt++)
     {
         _buttons[cnt] = new ControlButton(buttons[cnt].x, buttons[cnt].y, buttons[cnt].resId, (ButtonIds)buttons[cnt].id, buttons[cnt].flag, _resMan, _screenBuf, _system);
         _buttons[cnt].Draw();
     }
     _numButtons = num;
 }
Ejemplo n.º 45
0
 public void SuscribeButton(string ButtonName)
 {
     ButtonInfo newButtonInfo = new ButtonInfo();
     newButtonInfo.downSent = false;
     newButtonInfo.state = false;
     Buttons[ButtonName] = newButtonInfo;
 }
Ejemplo n.º 46
0
        void NavButtonChecked(object sender, RoutedEventArgs e)
        {
            DebugWrite();

            var button = new ButtonInfo(sender);
            button.Button.IsChecked = (button.HamburgerButtonInfo.ButtonType == HamburgerButtonInfo.ButtonTypes.Toggle);
            if (button.Button.IsChecked ?? true) Selected = button.HamburgerButtonInfo;
            if (button.Button.IsChecked ?? true) button.HamburgerButtonInfo.RaiseChecked(e);
            button.Button.IsHitTestVisible = !button.Button.IsChecked ?? false;
        }
Ejemplo n.º 47
0
        void NavButton_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
        {
            DebugWrite();

            var button = new ButtonInfo(sender);
            button.HamburgerButtonInfo.RaiseRightTapped(e);
            e.Handled = true;
        }
Ejemplo n.º 48
0
        void NavButton_Holding(object sender, Windows.UI.Xaml.Input.HoldingRoutedEventArgs e)
        {
            DebugWrite();

            var button = new ButtonInfo(sender);
            button.HamburgerButtonInfo.RaiseHolding(e);
            e.Handled = true;
        }
Ejemplo n.º 49
0
    public void ShowJewelTip(int _jewelId)
    {

        List<ButtonInfo> btnList = new List<ButtonInfo>();
        int textId = 905;
        ButtonInfo btn = new ButtonInfo() { action = OnInsetJewel, text = LanguageData.GetContent(textId), id = textId };
        btnList.Add(btn);
        InventoryManager.Instance.ShowJewelTip(_jewelId, btnList);
        //ItemJewelData jewel = ItemJewelData.dataMap[_jewelId];
        //InsetUIViewManager view = InsetUIViewManager.Instance;

        //view.SetDiamondTipLevel(jewel.level + "");
        //view.SetDiamondTipType(jewel.typeName);
        //view.SetDiamondTipDesc(jewel.effectDescriptionStr);
        //view.SetDiamondTipName(jewel.Name);
        //view.SetDiamondTipIcon(jewel.Icon, jewel.color);
        //view.SetDiamondTipIconBG(IconData.GetIconByQuality(jewel.quality));
        //view.ShowInsetDialogDiamondTip(true);

    }
Ejemplo n.º 50
0
        void NavButton_Loaded(object sender, RoutedEventArgs e)
        {
            DebugWrite();

            var button = new ButtonInfo(sender);
            if (LoadedNavButtons.ContainsKey(button.Button)) return;
            LoadedNavButtons.Add(button.Button, button.HamburgerButtonInfo);
            if (AllNavButtonsAreLoaded)
            {
                HighlightCorrectButton(NavigationService.CurrentPageType, NavigationService.CurrentPageParam);
            }
        }
Ejemplo n.º 51
0
        private GameObject CreateButton(GameObject prefab, string name, UIAnchor anchor, UIPivot pivot, Vector2 offset, out ButtonInfo buttonInfo) {
            buttonInfo = null;
            if(prefab == null) return null;
            
            GameObject instance = UITools.InstantiateGUIObject<ButtonInfo>(
                prefab,
                content.transform,
                name,
                pivot,
                anchor.min,
                anchor.max,
                offset
            );
            if(instance == null) return null;

            buttonInfo = instance.GetComponent<ButtonInfo>();
            Button button = instance.GetComponent<Button>();
            if(button == null) {
                Debug.Log("Button prefab is missing Button component!");
                return null;
            }
            if(buttonInfo == null) {
                Debug.Log("Button prefab is missing ButtonInfo component!");
                return null;
            }
            return instance;
        }
Ejemplo n.º 52
0
 public PointerDeviceEventArgs( int x, int y, ButtonInfo buttonInfo, string extraInfo, InputSource source )
 {
     X = x;
     Y = y;
     Source = source;
     ExtraInfo = extraInfo;
     ButtonInfo = buttonInfo;
 }
Ejemplo n.º 53
0
		public ThrowPage( Tag tag, string mainText, ButtonInfo buttonInfo, bool aThird ) {
			this.tag = tag;
			this.mainText = mainText;
			this.button = buttonInfo;
			this.aThird = aThird;
		}
Ejemplo n.º 54
0
        /// <summary>
        /// Draw game user interface
        /// </summary>
        /// <param name="spriteBatch">SpriteBatch</param>
        private void DrawGame(SpriteBatch spriteBatch)
        {
            map.Draw(spriteBatch);

            DrawFon(spriteBatch, new Rectangle(400, 0, Constants.WINDOW_NORMAL_SIZE_WIDTH - 1 - 400,
                Constants.WINDOW_NORMAL_SIZE_HEIGHT - 1));

            //class and race
            DrawStringInRectangle(spriteBatch,
                localization.Get("CLASS_" + ((int)HeroesClass + 1)) + " "
                + localization.Get("RACE_" + ((int)HeroesRace + 1)),
                new Rectangle(400, 0, 160, 18), Color.Red);

            //avatar
            Rectangle rectOfAvater = new Rectangle(400, 18, 80, 80);
            spriteBatch.Draw(ContentPack.PointTexture, rectOfAvater, Color.Black);
            spriteBatch.Draw(ContentPack.HeroTexture[(int)HeroesClass], rectOfAvater, Color.White);

            ////gold
            //Rectangle rectOfGold = new Rectangle(485, 23, 20, 20);
            //spriteBatch.Draw(ContentPack.pointTexture, rectOfGold, Color.Black);
            //DrawSquare(spriteBatch, rectOfGold, 1, Color.DimGray);
            //spriteBatch.Draw(ContentPack.tileTexture[(int)TileType.Gold], rectOfGold, Color.White);
            //spriteBatch.DrawString(ContentPack.font, map.saveData.Gold.ToString(), new Vector2(508, 23), Color.White);

            //hpPoison
            spriteBatch.Draw(ContentPack.PointTexture, buttonPotionHealth.Rectangle, Color.Black);
            DrawSquare(spriteBatch, buttonPotionHealth.Rectangle, 1, Color.White);
            spriteBatch.Draw(ContentPack.TileTexture[(int)TileType.HealthPotion],
                buttonPotionHealth.Rectangle, Color.White);
            spriteBatch.DrawString(ContentPack.Font, map.hero.HealthPotion.ToString(),
                new Vector2(508, 50), Color.White);

            //mpPoison
            spriteBatch.Draw(ContentPack.PointTexture, buttonPotionMana.Rectangle, Color.Black);
            DrawSquare(spriteBatch, buttonPotionMana.Rectangle, 1, Color.White);
            spriteBatch.Draw(ContentPack.TileTexture[(int)TileType.ManaPotion],
                buttonPotionMana.Rectangle, Color.White);
            spriteBatch.DrawString(ContentPack.Font, map.hero.ManaPotion.ToString(),
                new Vector2(508, 77), Color.White);

            //damage
            spriteBatch.Draw(ContentPack.TileTexture[(int)buttonAttack.Parameter],
                buttonAttack.Rectangle, Color.White);
            Color colorDamage = Color.White;
            int damage = map.hero.GetDamageNext(true, null);
            if (map.hero.DamageBase < damage)
                colorDamage = Color.Lime;
            else if (map.hero.DamageBase > damage)
                colorDamage = Color.Red;
            spriteBatch.DrawString(ContentPack.Font, damage + "", new Vector2(428, 101), colorDamage);

            //experience
            Rectangle rectOfExperience = new Rectangle(455, 103, 101, 17);
            spriteBatch.Draw(ContentPack.PointTexture, rectOfExperience, Color.Black);
            rectOfExperience.Width = 101 * map.hero.Experience / map.hero.ExperienceNextLevel;
            spriteBatch.Draw(ContentPack.PointTexture, rectOfExperience, Color.DarkGreen);
            spriteBatch.DrawString(ContentPack.Font,
                localization.Get("HERO_LEVEL") + " " + map.hero.Level + " ("
                + map.hero.Experience + "/" + map.hero.ExperienceNextLevel + ")",
                new Vector2(458, 101), Color.White);

            //health
            spriteBatch.Draw(ContentPack.TileTexture[(int)TileType.HPBoost],
                new Vector2(405, 124), Color.White);

            Rectangle rectOfHealth = new Rectangle(425, 126, 131, 17);
            spriteBatch.Draw(ContentPack.PointTexture, rectOfHealth, Color.Black);
            rectOfHealth.Width = 131 * map.hero.HealthCurrent / map.hero.HealthMax;
            spriteBatch.Draw(ContentPack.PointTexture, rectOfHealth,
                map.hero.Poisoned ? Color.Purple : Color.Red);

            //damage for hero
            if (monsterCurrent != null)
            {
                int damageToMonster = map.hero.GetDamageNext(true, monsterCurrent);
                bool liveMonster = monsterCurrent.HealthCurrent > damageToMonster;
                bool firstStrike = monsterCurrent.FirstStrike == false
                    && (map.hero.Level > monsterCurrent.Level || map.hero.FirstStrike == true);

                if (map.hero.ClassHero == Class.Assassin)
                    firstStrike = firstStrike || (monsterCurrent.FirstStrike == false
                        && referee.VisibleAroundMonster(monsterCurrent));

                if (!firstStrike || liveMonster
                    || (map.hero.ClassHero == Class.Assassin && map.hero.Level > monsterCurrent.Level))
                {
                    int healthHeroAfterStrikeX = 131 *
                        (map.hero.HealthCurrent - monsterCurrent.GetDamageNext(true, map.hero)) / map.hero.HealthMax;
                    if (map.hero.HealthCurrent - monsterCurrent.GetDamageNext(true, map.hero) < 0)
                        healthHeroAfterStrikeX = 0;
                    spriteBatch.Draw(ContentPack.PointTexture,
                        new Rectangle(rectOfHealth.X + healthHeroAfterStrikeX, rectOfHealth.Y,
                            rectOfHealth.Width - healthHeroAfterStrikeX, rectOfHealth.Height), Color.DarkRed);
                }
            }
            spriteBatch.DrawString(ContentPack.Font,
                map.hero.HealthCurrent + "/" + map.hero.HealthMax, new Vector2(428, 124), Color.White);

            //mana
            spriteBatch.Draw(ContentPack.TileTexture[(int)TileType.MPBoost],
                new Vector2(405, 147), Color.White);
            Rectangle rectOfMana = new Rectangle(425, 149, 131, 17);
            spriteBatch.Draw(ContentPack.PointTexture, rectOfMana, Color.Black);
            rectOfMana.Width = 131 * map.hero.ManaCurrent / map.hero.ManaMax;
            spriteBatch.Draw(ContentPack.PointTexture, rectOfMana, Color.Blue);
            spriteBatch.DrawString(ContentPack.Font,
                map.hero.ManaCurrent + "/" + map.hero.ManaMax, new Vector2(428, 147), Color.White);

            //magic
            // 4 slots
            if (map.hero.ClassHero == Class.Wizard)
            {
                for (int i = 0; i < 4; ++i)
                {
                    spriteBatch.Draw(ContentPack.MagicTexture[(int)map.hero.Magics[i]],
                        buttonMagic[i].Rectangle, Color.White);
                    if (map.hero.Magics[i] != MagicType.Empty
                        && map.hero.CostMagic(map.hero.Magics[i]) <= map.hero.ManaCurrent)
                        spriteBatch.Draw(ContentPack.MagicSelectTexture, buttonMagic[i].Rectangle, Color.White);
                }

            }
            else
            {
                for (int i = 0; i < 3; ++i)
                {
                    spriteBatch.Draw(ContentPack.MagicTexture[(int)map.hero.Magics[i]],
                        buttonMagic[i].Rectangle, Color.White);
                    if (map.hero.Magics[i] != MagicType.Empty
                        && map.hero.CostMagic(map.hero.Magics[i]) <= map.hero.ManaCurrent)
                        spriteBatch.Draw(ContentPack.MagicSelectTexture, buttonMagic[i].Rectangle, Color.White);
                }
            }
            spriteBatch.Draw(ContentPack.MagicTexture[(int)MagicType.Converter], buttonMagic[4].Rectangle, Color.White);

            if (CurrentMagicIndex >= 0)
                spriteBatch.Draw(ContentPack.MagicSelectTexture, buttonMagic[CurrentMagicIndex].Rectangle, Color.Lime);

            //window help
            Rectangle rectOfInfoArea = new Rectangle(401, 201, 159, 180);
            spriteBatch.Draw(ContentPack.PointTexture, rectOfInfoArea, Color.Black);
            DrawSquare(spriteBatch, rectOfInfoArea, 1, Color.White);

            MagicTile currentMagicTile = null;
            buttonInfo = null;

            if (monsterCurrent != null)
            {
                //avatar monster
                spriteBatch.Draw(ContentPack.MonsterTexture[(int)monsterCurrent.MonsterType],
                    new Rectangle(405, 205, 40, 40), Color.White);

                //monster type
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MONSTER_" + ((int)monsterCurrent.MonsterType + 1)),
                    new Vector2(450, 205), Color.White);

                //result of strike
                DrawResultStrikeStringOnInfoArea(spriteBatch);

                //damage monster
                spriteBatch.Draw(ContentPack.TileTexture[(int)TileType.Attackboost],
                    new Rectangle(405, 253, 20, 20), Color.White);
                spriteBatch.DrawString(ContentPack.Font, monsterCurrent.GetDamageNext(true, map.hero) + "",
                    new Vector2(428, 253), Color.White);

                //health monster
                spriteBatch.Draw(ContentPack.TileTexture[(int)TileType.HPBoost],
                    new Rectangle(405, 276, 20, 20), Color.White);

                Rectangle rectOfMonsterHealth = new Rectangle(425, 278, 131, 17);
                rectOfMonsterHealth.Width = 131 * monsterCurrent.HealthCurrent / monsterCurrent.HealthMax;
                spriteBatch.Draw(ContentPack.PointTexture, rectOfMonsterHealth,
                    monsterCurrent.Poisoned ? Color.Purple : Color.Red);
                int monsterHealthAfterStrike = 131 * (monsterCurrent.HealthCurrent
                    - map.hero.GetDamageNext(true, monsterCurrent))	/ monsterCurrent.HealthMax;

                if (map.hero.ClassHero == Class.Assassin && map.hero.Level > monsterCurrent.Level)
                    monsterHealthAfterStrike = 0;

                if (monsterCurrent.HealthCurrent - map.hero.GetDamageNext(true, monsterCurrent) < 0)
                    monsterHealthAfterStrike = 0;

                spriteBatch.Draw(ContentPack.PointTexture,
                    new Rectangle(rectOfMonsterHealth.X + monsterHealthAfterStrike,
                        rectOfMonsterHealth.Y,
                        rectOfMonsterHealth.Width - monsterHealthAfterStrike,
                        rectOfMonsterHealth.Height),
                    Color.DarkRed);

                spriteBatch.DrawString(ContentPack.Font,
                    monsterCurrent.HealthCurrent + "/" + monsterCurrent.HealthMax, new Vector2(428, 276), Color.White);

                string infoOnMonster = localization.Get("MONSTER_INFO_" + ((int)monsterCurrent.MonsterType + 1));
                if (monsterCurrent.MonsterType == MonsterType.Gorgon)
                    infoOnMonster += monsterCurrent.DeathGaze + "%)";
                spriteBatch.DrawString(ContentPack.Font, infoOnMonster,
                    new Vector2(405, 300), Color.White);

            }
            //magic under hero
            else if (map.magicTileList.Any(p => p.Rectangle == map.hero.Rectangle))
            {
                foreach (MagicTile magicTile in map.magicTileList)
                {
                    if (magicTile.Rectangle == map.hero.Rectangle)
                        currentMagicTile = magicTile;
                }
                spriteBatch.Draw(ContentPack.MagicTexture[(int)currentMagicTile.Magic],
                    new Rectangle(405, 205, 40, 40), Color.White);
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MAGIC_" + (int)currentMagicTile.Magic),
                    new Vector2(450, 205), Color.Lime);
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MANA_COST_STRING") + ": " + map.hero.CostMagic(currentMagicTile.Magic),
                    new Vector2(450, 220), Color.White);

                //pick up button
                buttonInfo = new ButtonInfo(new Rectangle(445, 253, 71, 26));
                buttonInfo.Text = localization.Get("BUTTON_INFO_MAGIC");
                buttonInfo.Draw(spriteBatch);

                //info
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MAGIC_INFO_" + (int)currentMagicTile.Magic),
                    new Vector2(405, 280), Color.White);
            }
            else if (buttonBonusCurrent != null)
            {
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("DAMAGE_BASE_STRING") + ": " + map.hero.DamageBase,
                    new Vector2(405, 205), Color.White);

                Color color = Color.White;
                if (map.hero.DamageBonus < 0)
                    color = Color.Red;
                else if (map.hero.DamageBonus > 0)
                    color = Color.Lime;
                int damageBonus = map.hero.DamageBonus + map.hero.DamageNextBonus;
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("DAMAGE_BONUS_STRING") + ": " + damageBonus + "%",
                    new Vector2(405, 225), color);

                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("DAMAGE_TOTAL_STRING") + ": " + map.hero.GetDamageNext(true, null),
                    new Vector2(405, 245), Color.White);
            }
            else if (buttonMagicCurrent != null && buttonMagicCurrent.Parameter != MagicType.Empty)
            {
                spriteBatch.Draw(ContentPack.MagicTexture[(int)buttonMagicCurrent.Parameter],
                    new Rectangle(405, 205, 40, 40), Color.White);
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MAGIC_" + (int)buttonMagicCurrent.Parameter),
                    new Vector2(450, 205), Color.Lime);
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MANA_COST_STRING") + ": " + map.hero.CostMagic(buttonMagicCurrent.Parameter),
                    new Vector2(450, 220), Color.White);

                if (buttonMagicCurrent.Parameter == MagicType.Fireball)
                    spriteBatch.DrawString(ContentPack.Font,
                        localization.Get("DAMAGE_FIREBALL_STRING") + ": "
                            + Constants.DAMAGE_FIREBALL_PER_LEVEL * map.hero.Level,
                        new Vector2(405, 250), Color.White);

                //info
                spriteBatch.DrawString(ContentPack.Font,
                    localization.Get("MAGIC_INFO_" + (int)buttonMagicCurrent.Parameter),
                    new Vector2(405, 280), Color.White);
            }
            else
            {
                string info = "";
                if (map.hero.FirstStrike)
                    info += localization.Get("MAGIC_" + (int)MagicType.FirstStrike) + '\n';
                if (map.hero.KillProtect)
                    info += localization.Get("MAGIC_" + (int)MagicType.KillProtect) + '\n';
                if (map.hero.Might)
                    info += localization.Get("MAGIC_" + (int)MagicType.Might) + '\n';
                spriteBatch.DrawString(ContentPack.Font, info,
                    new Vector2(405, 205), Color.White);
            }

            buttonExit.Draw(spriteBatch);
        }
Ejemplo n.º 55
0
 public void OnButtonActivated(ButtonInfo buttonInfo) {
     if(inputFieldActivatedCallback == null) return;
     inputFieldActivatedCallback(rowIndex, buttonInfo);
 }
Ejemplo n.º 56
0
 public void ShowEquipInfo(ItemParent item)
 {
     List<ButtonInfo> btnList = new List<ButtonInfo>();
     ButtonInfo btn = new ButtonInfo() { action = OnLockChange };
     int textId = 0;
     if (((ItemEquipment)item).locked)
     {
         textId = 1081;
     }
     else
     {
         textId = 1082;
     }
     btn.text = LanguageData.GetContent(textId);
     btn.id = textId;
     btnList.Add(btn);
     InventoryManager.Instance.ShowEquipTip(item as ItemEquipment, btnList, MogoWorld.thePlayer.level);
 }
Ejemplo n.º 57
0
 public WheelActionEventArgs( int x, int y, ButtonInfo buttonInfo, string extraInfo, InputSource source, int wheelDelta )
     : base(x, y, buttonInfo, extraInfo, source)
 {
     Delta = wheelDelta;
 }
Ejemplo n.º 58
0
        //JL : duplicate with MouseCodeFromButtonInfo in InputTrigger. Where can it be put to avoid duplication ?
        public int MouseCodeFromButtonInfo( ButtonInfo buttonInfo, string extraInfo )
        {
            if( buttonInfo == ButtonInfo.DefaultButton )
            {
                return 1;
            }

            if( buttonInfo == ButtonInfo.XButton )
            {
                if( extraInfo == "Right" )
                    return 2;

                if( extraInfo == "Middle" )
                    return 3;
            }

            throw new Exception( String.Format( "The specified buttonInfo is incorrect. (ButtonInfo : {0}, ExtraInfo : {1}) ", buttonInfo.ToString(), extraInfo ) );
        }
Ejemplo n.º 59
0
 private GameObject CreateButton(GameObject prefab, string name, Rewired.UI.UIAnchor anchor, UIPivot pivot, Vector2 offset, out ButtonInfo buttonInfo)
 {
     buttonInfo = null;
     if (prefab == null)
     {
         return null;
     }
     GameObject gameObject = UITools.InstantiateGUIObject<ButtonInfo>(prefab, this.content.transform, name, pivot, anchor.min, anchor.max, offset);
     if (gameObject == null)
     {
         return null;
     }
     buttonInfo = gameObject.GetComponent<ButtonInfo>();
     UnityEngine.UI.Button component = gameObject.GetComponent<UnityEngine.UI.Button>();
     if (component == null)
     {
         UnityEngine.Debug.Log("Button prefab is missing Button component!");
         return null;
     }
     if (buttonInfo == null)
     {
         UnityEngine.Debug.Log("Button prefab is missing ButtonInfo component!");
         return null;
     }
     return gameObject;
 }
Ejemplo n.º 60
0
		public ThrowPage( Tag tag, string mainText, ButtonInfo buttonInfo ) {
			this.tag = tag;
			this.mainText = mainText;
			this.button = buttonInfo;
			this.aThird = false;
		}