Exemplo n.º 1
0
        static void Main(string[] args)
        {
            /// Initialize the UI-core and install the XNA-plugin (TODO: make it configurable)
            UIRoot   root      = new UIRoot();
            Assembly xnaPlugin = Assembly.Load("RC.UI.XnaPlugin, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");

            root.LoadPlugins(xnaPlugin);
            root.InstallPlugins();

            /// Create the UIWorkspace and set the mouse pointer
            UIWorkspace workspace = new UIWorkspace(new RCIntVector(1024, 768), new RCIntVector(1024, 768));

            UISprite mouseIcon = root.GraphicsPlatform.SpriteManager.LoadSprite("..\\..\\..\\..\\sprites\\pointers\\normal_pointer.png");

            mouseIcon.TransparentColor = new RCColor(255, 0, 255);
            mouseIcon.Upload();
            UIPointer pointer = new UIPointer(mouseIcon, new RCIntVector(0, 0));

            UIWorkspace.Instance.SetDefaultMousePointer(pointer);

            /// Create and activate the test page
            RCMotionControlTestPage motionControlTestPage = new RCMotionControlTestPage();

            UIWorkspace.Instance.RegisterPage(motionControlTestPage);
            motionControlTestPage.Activate();

            /// Start and run the render loop
            root.GraphicsPlatform.RenderLoop.Start(workspace.DisplaySize);

            /// After the render loop has been stopped, release all resources of the UIRoot.
            root.GraphicsPlatform.SpriteManager.DestroySprite(mouseIcon);
            root.Dispose();
        }
Exemplo n.º 2
0
    /// <summary>
    /// Place the ghost at the pointer's position
    /// </summary>
    /// <param name="pointer">The pointer to place the ghost at</param>
    /// <exception cref="InvalidOperationException">If we're not in the correct state</exception>
    protected void PlaceGhost(UIPointer pointer)
    {
        if (m_CurrentTower == null || !isBuilding)
        {
            throw new InvalidOperationException(
                      "Trying to position a tower ghost while the UI is not currently in a building state.");
        }

        MoveGhost(pointer);

        if (m_CurrentArea != null)
        {
            TowerFitStatus fits = m_CurrentArea.Fits(m_GridPosition, m_CurrentTower.controller.dimensions);

            if (fits == TowerFitStatus.Fits)
            {
                // Place the ghost
                Tower controller = m_CurrentTower.controller;

                if (activePeones)
                {
                    SpawnPeonesTeam();
                }
                else
                {
                    Tower createdTower = Instantiate(controller);
                    createdTower.Initialize(m_CurrentArea, m_GridPosition);
                }
                CancelGhostPlacement();
            }
        }
    }
Exemplo n.º 3
0
 public void AttachPointerToGameObject(GameObject go, Boolean isSnapCenter)
 {
     if (go != (UnityEngine.Object)null)
     {
         if (!this.attachList.ContainsKey(go))
         {
             UIPointer pointerFromPool = this.GetPointerFromPool(this.PointerDepth);
             UIWidget  component       = pointerFromPool.GetComponent <UIWidget>();
             UIWidget  component2      = go.GetComponent <UIWidget>();
             pointerFromPool.name = go.name + " Pointer";
             pointerFromPool.transform.position = go.transform.position;
             Vector3 referenceVector = (!isSnapCenter) ? new Vector3((Single)(0 - component2.width / 2 + component.width / 4), (Single)(0 - component.height / 4), 0f) : Vector3.zero;
             pointerFromPool.AttachToGameObject(go.transform, referenceVector, this.pointerOffset, this.pointerLimitRect);
             this.attachList.Add(go, pointerFromPool);
         }
         else
         {
             UIPointer uipointer = this.attachList[go];
             uipointer.PointerLimitRect = this.pointerLimitRect;
             uipointer.PointerOffset    = this.pointerOffset;
             this.SetPointerVisibility(go, true);
         }
     }
     else
     {
         global::Debug.LogWarning("AttachPointerToGameObject() : Input GameObject is null!");
     }
 }
Exemplo n.º 4
0
    private void UpdateProperties()
    {
        if ((FF9StateSystem.Battle.FF9Battle.cmd_status & 2) != 0)
        {
            UIPointer pointerFromButton = Singleton <PointerManager> .Instance.GetPointerFromButton(base.gameObject);

            if (pointerFromButton == (UnityEngine.Object)null || !pointerFromButton.enabled)
            {
                Singleton <PointerManager> .Instance.SetPointerVisibility(base.gameObject, true);
            }
            if (this.lastPos != this.target.position || !this.worldCam.worldToCameraMatrix.Equals(this.lastWorldMatrix))
            {
                this.lastPos         = this.target.position;
                this.lastWorldMatrix = this.worldCam.worldToCameraMatrix;
                this.worldBottomPos  = this.target.position;
                this.worldTopPos     = this.worldBottomPos + new Vector3(0f, this.height, 0f);
                Vector3 position  = this.worldCam.WorldToScreenPoint(this.worldTopPos);
                Vector3 vector    = this.uiCam.ScreenToWorldPoint(position);
                Vector3 position2 = this.worldCam.WorldToScreenPoint(this.worldBottomPos);
                Vector3 vector2   = this.uiCam.ScreenToWorldPoint(position2);
                Single  num       = vector.y - vector2.y;
                Single  num2      = num * this.width / this.height;
                base.transform.position = new Vector3(vector2.x, vector2.y, base.transform.position.z);
                base.GetComponent <UIWidget>().height = (Int32)(num * this.multiplier / this.scaleRatio.y);
                base.GetComponent <UIWidget>().width  = (Int32)(num2 * this.multiplier / this.scaleRatio.y);
            }
        }
        else
        {
            Singleton <PointerManager> .Instance.SetPointerVisibility(base.gameObject, false);
        }
    }
Exemplo n.º 5
0
 public void SetPointerHelpAt(GameObject go, Boolean isHelp, Boolean isImmediate)
 {
     if (go != (UnityEngine.Object)null && this.attachList.ContainsKey(go))
     {
         UIPointer uipointer = this.attachList[go];
         uipointer.SetHelpActive(isHelp, isImmediate);
     }
 }
Exemplo n.º 6
0
 public void SetPointerVisibility(GameObject go, Boolean isVisible)
 {
     if (this.attachList.ContainsKey(go))
     {
         UIPointer uipointer = this.attachList[go];
         uipointer.SetActive(isVisible);
     }
 }
Exemplo n.º 7
0
 public void SetPointerLimitRectBehavior(GameObject go, PointerManager.LimitRectBehavior behavior)
 {
     if (go != (UnityEngine.Object)null && this.attachList.ContainsKey(go))
     {
         UIPointer uipointer = this.attachList[go];
         uipointer.Behavior = behavior;
     }
 }
Exemplo n.º 8
0
 public void SetPointerNumberAt(GameObject go, Int32 number)
 {
     if (go != (UnityEngine.Object)null && this.attachList.ContainsKey(go))
     {
         UIPointer uipointer = this.attachList[go];
         uipointer.SetNumberActive(true, number);
     }
 }
Exemplo n.º 9
0
    public void Build(PointerSettings pSettings, PointerType type) {
		_type = type;

		_pointerRendererObj = new GameObject ("Renderer");
		_pointerRendererObj.transform.SetParent (gameObject.transform, false);

		_uiPointer = _pointerRendererObj.AddComponent<UIPointer> ();
		_uiPointer.Build (pSettings, _type);
	}
Exemplo n.º 10
0
    public void Build(PointerSettings pSettings, PointerType type)
    {
        _type = type;

        _pointerRendererObj = new GameObject("Renderer");
        _pointerRendererObj.transform.SetParent(gameObject.transform, false);

        _uiPointer = _pointerRendererObj.AddComponent <UIPointer> ();
        _uiPointer.Build(pSettings, _type);
    }
Exemplo n.º 11
0
    /// <summary>
    /// Calculates whether the given pointer is over the current tower ghost
    /// </summary>
    /// <param name="pointerInfo">
    /// The information used to check against the <see cref="m_CurrentTower"/>
    /// </param>
    /// <exception cref="InvalidOperationException">
    /// Throws an exception if not in Build Mode
    /// </exception>
    public bool IsPointerOverGhost(PointerInfo pointerInfo)
    {
        if (state != State.Building)
        {
            throw new InvalidOperationException("Trying to tap on ghost tower when not in Build Mode");
        }
        UIPointer  uiPointer = WrapPointer(pointerInfo);
        RaycastHit hit;

        return(m_CurrentTower.ghostCollider.Raycast(uiPointer.ray, out hit, float.MaxValue));
    }
Exemplo n.º 12
0
    /// <summary>
    /// Attempt to position a tower at the given location
    /// </summary>
    /// <param name="pointerInfo">The pointer we're using to position the tower</param>
    public void TryPlaceTower(PointerInfo pointerInfo)
    {
        UIPointer pointer = WrapPointer(pointerInfo);

        // Do nothing if we're over UI
        if (pointer.overUI)
        {
            return;
        }
        BuyTower(pointer);
    }
Exemplo n.º 13
0
 public void SetPointerBlinkAt(GameObject go, Boolean isBlink)
 {
     if (go != (UnityEngine.Object)null && this.attachList.ContainsKey(go))
     {
         UIPointer uipointer = this.attachList[go];
         uipointer.SetBlinkActive(isBlink);
         if (isBlink)
         {
             this.SetPointerHelpAt(go, false, true);
         }
     }
 }
Exemplo n.º 14
0
    private void Awake()
    {
        currentScale = 1;
        // Only allow one instance at runtime.
        if (_instance != null && _instance != this)
        {
            enabled = false;
            DestroyImmediate(this);
            return;
        }

        this.GetComponent <TrailRenderer>().sortingLayerName = "UI";
        _instance = this;
    }
Exemplo n.º 15
0
        void Awake()
        {
            _pointer         = GetComponent <UIPointer>();
            _line            = gameObject.AddComponent <LineRenderer>();
            _line.startWidth = _line.endWidth = LineWidth;

            _line.material.color        = invalidCollisionColor;
            _pointer.HoverChangedEvent += (oldHovered, newHovered) =>
            {
                _line.material.color = newHovered != null ? validCollisionColor : invalidCollisionColor;
            };

            _pointer.IsActiveChangedEvent += isActive => _line.enabled = isActive;
        }
Exemplo n.º 16
0
    /// <summary>
    /// Position the ghost tower at the given pointer
    /// </summary>
    /// <param name="pointerInfo">The pointer we're using to position the tower</param>
    /// <param name="hideWhenInvalid">Optional parameter for configuring if the ghost is hidden when in an invalid location</param>
    public void TryMoveGhost(PointerInfo pointerInfo, bool hideWhenInvalid = true)
    {
        if (m_CurrentTower == null)
        {
            throw new InvalidOperationException("Trying to move the tower ghost when we don't have one");
        }

        UIPointer pointer = WrapPointer(pointerInfo);

        // Do nothing if we're over UI
        if (pointer.overUI && hideWhenInvalid)
        {
            m_CurrentTower.Hide();
            return;
        }
        MoveGhost(pointer, hideWhenInvalid);
    }
Exemplo n.º 17
0
    /// <summary>
    /// Raycast onto tower placement areas
    /// </summary>
    /// <param name="pointer">The pointer we're testing</param>
    protected void PlacementAreaRaycast(ref UIPointer pointer)
    {
        pointer.raycast = null;

        if (pointer.overUI)
        {
            // Pointer is over UI, so no valid position
            return;
        }

        // Raycast onto placement area layer
        RaycastHit hit;

        if (Physics.Raycast(pointer.ray, out hit, float.MaxValue, placementAreaMask))
        {
            pointer.raycast = hit;
        }
    }
Exemplo n.º 18
0
 public void SetAllPointerVisibility(Boolean isVisible)
 {
     foreach (KeyValuePair <GameObject, UIPointer> keyValuePair in this.attachList)
     {
         UIPointer value = keyValuePair.Value;
         value.SetActive(isVisible);
         if (!isVisible)
         {
             Singleton <HelpDialog> .Instance.HideDialog();
         }
         else if (isVisible && ButtonGroupState.HelpEnabled)
         {
             ButtonGroupState component = keyValuePair.Key.GetComponent <ButtonGroupState>();
             if (component != (UnityEngine.Object)null && component.Help.Enable)
             {
                 Singleton <HelpDialog> .Instance.ShowDialog();
             }
         }
     }
 }
Exemplo n.º 19
0
    /// <summary>
    /// Move the ghost to the pointer's position
    /// </summary>
    /// <param name="pointer">The pointer to place the ghost at</param>
    /// <param name="hideWhenInvalid">Optional parameter for whether the ghost should be hidden or not</param>
    /// <exception cref="InvalidOperationException">If we're not in the correct state</exception>
    protected void MoveGhost(UIPointer pointer, bool hideWhenInvalid = true)
    {
        if (m_CurrentTower == null || !isBuilding)
        {
            throw new InvalidOperationException(
                      "Trying to position a tower ghost while the UI is not currently in the building state.");
        }

        // Raycast onto placement layer
        PlacementAreaRaycast(ref pointer);

        if (pointer.raycast != null)
        {
            MoveGhostWithRaycastHit(pointer.raycast.Value);
        }
        else
        {
            MoveGhostOntoWorld(pointer.ray, hideWhenInvalid);
        }
    }
Exemplo n.º 20
0
    /// <summary>
    /// Selects a tower beneath the given pointer if there is one
    /// </summary>
    /// <param name="info">
    /// The pointer information concerning the selector of the pointer
    /// </param>
    /// <exception cref="InvalidOperationException">
    /// Throws an exception when not in <see cref="State.Normal"/>
    /// </exception>
    public void TrySelectTower(PointerInfo info)
    {
        if (state != State.Normal)
        {
            throw new InvalidOperationException("Trying to select towers outside of Normal state");
        }
        UIPointer  uiPointer = WrapPointer(info);
        RaycastHit output;
        bool       hasHit = Physics.Raycast(uiPointer.ray, out output, float.MaxValue, towerSelectionLayer);

        if (!hasHit || uiPointer.overUI)
        {
            return;
        }
        var controller = output.collider.GetComponent <Tower>();

        if (controller != null)
        {
            SelectTower(controller);
        }
    }
        internal void NavigateBackwardHandler(ICDSPluginExecutionContext executionContext)
        {
            var req = executionContext.CreateOrganizationRequest <ccllc_BTF_NavigateBackwardRequest>();

            EntityReference transactionId = req.Target ?? throw new NullReferenceException("Target cannot be null");
            EntityReference userId        = req.UserId ?? new EntityReference("systemuser", executionContext.InitiatingUserId);

            var systemUser = new SystemUser(userId.LogicalName, userId.Id, userId.Name);

            var platformService = Container.Resolve <IPlatformService>();
            var session         = platformService.GenerateSession(executionContext, systemUser);

            var managerFactory = Container.Resolve <ITransactionServiceFactory>();
            var manager        = managerFactory.CreateTransactionService(executionContext);

            var transaction = manager.LoadTransaction(executionContext, transactionId.ToRecordPointer());

            IUIPointer uiPointer = null;
            var        step      = transaction.NavigateBackward(session);

            if (step.Type.IsUIStep)
            {
                uiPointer = step.GetUIPointer(executionContext, transaction);
            }

            if (uiPointer == null)
            {
                // At this point something is wrong so navigate the user to the transaction error form.
                uiPointer = new UIPointer
                {
                    UIDefinition = "TransactionError",
                    UIRecordId   = transaction.Id,
                    UIRecordType = "ccllc_transaction",
                    UIType       = eUIStepTypeEnum.DataForm
                };
            }

            executionContext.OutputParameters["UIPointer"] = uiPointer.Serialize();
        }
Exemplo n.º 22
0
    /// <summary>
    /// Used to buy the tower during the build phase
    /// Checks currency and calls <see cref="PlaceGhost" />
    /// <exception cref="InvalidOperationException">
    /// Throws exception when not in a build mode or when tower is not a valid position
    /// </exception>
    /// </summary>
    public void BuyTower(UIPointer pointer)
    {
        if (!isBuilding)
        {
            throw new InvalidOperationException("Trying to buy towers when not in a Build Mode");
        }
        if (m_CurrentTower == null || !IsGhostAtValidPosition())
        {
            return;
        }
        PlacementAreaRaycast(ref pointer);
        if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null)
        {
            CancelGhostPlacement();
            return;
        }
        int  cost = m_CurrentTower.controller.purchaseCost;
        bool successfulPurchase = PlayerStats.Instance.TryPurchase(cost);

        if (successfulPurchase)
        {
            PlaceGhost(pointer);
        }
    }
Exemplo n.º 23
0
        public static void Test()
        {
            ConfigurationManager.Initialize("../../../../config/RC.UI.Test/RC.UI.Test.root");
            UIRoot   root      = new UIRoot();
            Assembly xnaPlugin = Assembly.Load("RC.UI.XnaPlugin, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");

            root.LoadPlugins(xnaPlugin);
            root.InstallPlugins();

            DynamicString.RegisterResolver("RC.UI.UIWorkspace.PixelScaling",
                                           delegate()
            {
                return("2;2");
            });
            UIResourceManager.LoadResourceGroup("RC.App.SplashScreen");
            UIResourceManager.LoadResourceGroup("RC.App.CommonResources");

            UISprite mouseIcon = root.GraphicsPlatform.SpriteManager.LoadSprite("..\\..\\..\\..\\sprites\\pointers\\normal_pointer.png", new RCIntVector(2, 2));

            mouseIcon.TransparentColor = new RCColor(255, 0, 255);
            mouseIcon.Upload();
            UIPointer pointer = new UIPointer(mouseIcon, new RCIntVector(0, 0));

            display   = new TestUIObject(new RCIntVector(2, 2), new RCIntVector(0, 0), new RCIntRectangle(0, 0, 400, 300));
            workspace = new MySensitiveAnimObject(new RCIntVector(40, 50), new RCIntRectangle(0, 0, 320, 200),
                                                  "Workspace", RCColor.Gray, RCColor.Gray);
            display.Attach(workspace);

            MyButton button = new MyButton(new RCIntVector(5, 12), new RCIntVector(60, 20),
                                           RCColor.Brown, RCColor.Yellow, RCColor.White,
                                           "MyButton");
            //button.MouseSensor.Enter += delegate(UISensitiveObject sender) { Console.WriteLine("BUTTON ENTER"); };
            //button.MouseSensor.Move += delegate(UISensitiveObject sender, UIMouseEventArgs args) { Console.WriteLine("BUTTON MOVE"); };
            //button.MouseSensor.Leave += delegate(UISensitiveObject sender) { Console.WriteLine("BUTTON LEAVE"); };
            MyCheckbox checkbox = new MyCheckbox(new RCIntVector(70, 12), new RCIntVector(80, 20),
                                                 RCColor.Red, RCColor.Green, RCColor.LightRed, RCColor.LightGreen, RCColor.White,
                                                 "MyCheckbox");
            MyDropdownSelector selector = new MyDropdownSelector(new RCIntVector(5, 50), new RCIntVector(60, 20),
                                                                 new string[4] {
                "option0", "option1", "option2", "option3"
            },
                                                                 RCColor.WhiteHigh, RCColor.Red,
                                                                 RCColor.Green, RCColor.LightGreen, RCColor.LightBlue, RCColor.Gray);
            //selector.MouseSensor.Enter += delegate(UISensitiveObject sender) { Console.WriteLine("SELECTOR ENTER"); };
            //selector.MouseSensor.Move += delegate(UISensitiveObject sender, UIMouseEventArgs args) { Console.WriteLine("SELECTOR MOVE"); };
            //selector.MouseSensor.Leave += delegate(UISensitiveObject sender) { Console.WriteLine("SELECTOR LEAVE"); };
            MySlider sliderHorz = new MySlider(new RCIntVector(5, 80), new RCIntVector(80, 10),
                                               new UISlider.Settings()
            {
                Alignment            = UISlider.Alignment.Horizontal,
                IntervalLength       = 10,
                SliderBottom         = 3,
                SliderLeft           = 1,
                SliderRight          = 1,
                SliderTop            = 3,
                TimeBetweenTrackings = 300,
                TrackingValueChange  = 3,
                TrackPos             = new RCIntVector(10, 5),
                TrackSize            = new RCIntVector(60, 1)
            },
                                               RCColor.Green, RCColor.LightGreen, RCColor.White);
            MySlider sliderVert = new MySlider(new RCIntVector(5, 100), new RCIntVector(10, 80),
                                               new UISlider.Settings()
            {
                Alignment            = UISlider.Alignment.Vertical,
                IntervalLength       = 10,
                SliderBottom         = 1,
                SliderLeft           = 3,
                SliderRight          = 3,
                SliderTop            = 1,
                TimeBetweenTrackings = 300,
                TrackingValueChange  = 3,
                TrackPos             = new RCIntVector(5, 10),
                TrackSize            = new RCIntVector(60, 1)
            },
                                               RCColor.Green, RCColor.LightGreen, RCColor.White);

            workspace.Attach(button);
            workspace.Attach(checkbox);
            workspace.Attach(selector);
            workspace.Attach(sliderHorz);
            workspace.Attach(sliderVert);
            workspace.AttachSensitive(button);
            workspace.AttachSensitive(checkbox);
            workspace.AttachSensitive(selector);
            workspace.AttachSensitive(sliderHorz);
            workspace.AttachSensitive(sliderVert);
            button.Pressed += delegate(UISensitiveObject sender)
            {
                TraceManager.WriteAllTrace("BUTTON PRESSED", TraceManager.GetTraceFilterID("RC.UI.Test.Info"));
                checkbox.IsEnabled = !checkbox.IsEnabled;
            };
            checkbox.CheckedStateChanged += delegate(UISensitiveObject sender)
            {
                TraceManager.WriteAllTrace("CHECKBOX STATE CHANGED", TraceManager.GetTraceFilterID("RC.UI.Test.Info"));
                button.IsEnabled = checkbox.IsChecked;
            };
            selector.SelectedIndexChanged += delegate(UISensitiveObject sender)
            {
                TraceManager.WriteAllTrace("SELECTED INDEX CHANGED", TraceManager.GetTraceFilterID("RC.UI.Test.Info"));
            };
            sliderHorz.SelectedValueChanged += delegate(UISensitiveObject sender)
            {
                TraceManager.WriteAllTrace(string.Format("SELECTED VALUE CHANGED (horizontal): {0}", sliderHorz.SelectedValue), TraceManager.GetTraceFilterID("RC.UI.Test.Info"));
            };
            sliderVert.SelectedValueChanged += delegate(UISensitiveObject sender)
            {
                TraceManager.WriteAllTrace(string.Format("SELECTED VALUE CHANGED (vertical): {0}", sliderVert.SelectedValue), TraceManager.GetTraceFilterID("RC.UI.Test.Info"));
            };

            UIMouseManager mouseMgr = new UIMouseManager(workspace);

            mouseMgr.SetDefaultMousePointer(pointer);

            root.GraphicsPlatform.RenderManager.Attach(display);
            root.GraphicsPlatform.RenderLoop.Start(new RCIntVector(800, 600));

            root.Dispose();
        }
Exemplo n.º 24
0
        public static void Test()
        {
            ConfigurationManager.Initialize("../../../../config/RC.UI.Test/RC.UI.Test.root");
            UIRoot   root      = new UIRoot();
            Assembly xnaPlugin = Assembly.Load("RC.UI.XnaPlugin, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");

            root.LoadPlugins(xnaPlugin);
            root.InstallPlugins();

            UISprite mouseIcon = root.GraphicsPlatform.SpriteManager.LoadSprite("..\\..\\..\\..\\sprites\\pointers\\normal_pointer.png", new RCIntVector(2, 2));

            mouseIcon.TransparentColor = new RCColor(255, 0, 255);
            mouseIcon.Upload();
            UIPointer pointer = new UIPointer(mouseIcon, new RCIntVector(0, 0));

            DynamicString.RegisterResolver("RC.UI.UIWorkspace.PixelScaling",
                                           delegate()
            {
                return("2;2");
            });
            UIResourceManager.LoadResourceGroup("RC.App.SplashScreen");
            UIResourceManager.LoadResourceGroup("RC.App.CommonResources");

            display   = new TestUIObject(new RCIntVector(2, 2), new RCIntVector(0, 0), new RCIntRectangle(0, 0, 400, 300));
            workspace = new MySensitiveObject(new RCIntVector(40, 50), new RCIntRectangle(0, 0, 320, 200),
                                              "Workspace", RCColor.Gray, RCColor.Gray);
            display.Attach(workspace);

            MySensitiveObject objA = new MySensitiveObject(new RCIntVector(5, 12), new RCIntRectangle(0, 0, 130, 90), "A", RCColor.Blue, RCColor.LightBlue);
            MySensitiveObject objB = new MySensitiveObject(new RCIntVector(5, 107), new RCIntRectangle(0, 0, 130, 90), "B", RCColor.Blue, RCColor.LightBlue);
            MyDraggableObject objC = new MyDraggableObject(new RCIntVector(140, 12), new RCIntRectangle(0, 0, 130, 180), "C", RCColor.Cyan, RCColor.LightCyan);

            workspace.Attach(objA);
            workspace.Attach(objB);
            workspace.Attach(objC);
            workspace.AttachSensitive(objA);
            workspace.AttachSensitive(objB);
            workspace.AttachSensitive(objC);

            MySensitiveObject objAA = new MySensitiveObject(new RCIntVector(5, 12), new RCIntRectangle(0, 0, 120, 30), "AA", RCColor.Green, RCColor.LightGreen);
            MySensitiveObject objAB = new MySensitiveObject(new RCIntVector(5, 47), new RCIntRectangle(0, 0, 120, 30), "AB", RCColor.Green, RCColor.LightGreen);
            MySensitiveObject objBA = new MySensitiveObject(new RCIntVector(5, 12), new RCIntRectangle(0, 0, 120, 30), "BA", RCColor.Green, RCColor.LightGreen);
            MySensitiveObject objBB = new MySensitiveObject(new RCIntVector(5, 47), new RCIntRectangle(0, 0, 120, 30), "BB", RCColor.Green, RCColor.LightGreen);
            MyDraggableObject objCA = new MyDraggableObject(new RCIntVector(5, 12), new RCIntRectangle(0, 0, 120, 30), "CA", RCColor.Magenta, RCColor.LightMagenta);
            MyDraggableObject objCB = new MyDraggableObject(new RCIntVector(5, 47), new RCIntRectangle(0, 0, 120, 30), "CB", RCColor.Gray, RCColor.White);

            objA.Attach(objAA);
            objA.Attach(objAB);
            objB.Attach(objBA);
            objB.Attach(objBB);
            objC.Attach(objCA);
            objC.Attach(objCB);
            objA.AttachSensitive(objAA);
            objA.AttachSensitive(objAB);
            objB.AttachSensitive(objBA);
            objB.AttachSensitive(objBB);
            objC.AttachSensitive(objCA);
            objC.AttachSensitive(objCB);

            //root.SystemEventQueue.Subscribe<UIKeyboardEventArgs>(OnKeyboardEvent);
            //root.SystemEventQueue.Subscribe<UIMouseEventArgs>(OnMouseEvent);

            UIMouseManager mouseMgr = new UIMouseManager(workspace);

            mouseMgr.SetDefaultMousePointer(pointer);

            root.GraphicsPlatform.RenderManager.Attach(display);
            root.GraphicsPlatform.RenderLoop.Start(new RCIntVector(800, 600));

            root.Dispose();
        }
Exemplo n.º 25
0
        /// <see cref="UISensitiveObject.GetMousePointer"/>
        public sealed override UIPointer GetMousePointer(RCIntVector localPosition)
        {
            UIPointer pointer = this.GetMousePointer_i(localPosition);

            return(pointer != null ? pointer : this.extendedControl.GetMousePointer(localPosition));
        }
Exemplo n.º 26
0
        internal void InitiateTransactionHandler(ICDSPluginExecutionContext executionContext)
        {
            var req = (executionContext.CreateOrganizationRequest <ccllc_BTF_InitiateTransactionRequest>());

            if (string.IsNullOrEmpty(req.ContextRecordType))
            {
                throw new ArgumentNullException("ContextRecordType cannot be null.");
            }
            if (string.IsNullOrEmpty(req.ContextRecordId))
            {
                throw new ArgumentNullException("ContextRecordId cannot be null.");
            }

            if (!Guid.TryParse(req.ContextRecordId, out Guid recordId))
            {
                throw new ArgumentException("ContextRecordId cannot be converted to a GUID.");
            }

            var contextRecordId   = new RecordPointer <Guid>(req.ContextRecordType, recordId);
            var transactionTypeId = req.TransactionTypeId ?? throw new NullReferenceException("TransactionTypeId cannot be null");
            var userId            = req.UserId ?? new EntityReference("systemuser", executionContext.InitiatingUserId);

            var systemUser = new SystemUser(userId.LogicalName, userId.Id, userId.Name);

            var platformService = Container.Resolve <IPlatformService>();

            var session = platformService.GenerateSession(executionContext, systemUser);

            var contextFactory     = Container.Resolve <ITransactionContextFactory>();
            var transactionContext = contextFactory.CreateTransactionContext(executionContext, contextRecordId);

            var serviceFactory = Container.Resolve <ITransactionServiceFactory>();
            var service        = serviceFactory.CreateTransactionService(executionContext);

            var transactionType = service.GetAvaialbleTransactionTypes(executionContext, session, transactionContext).Where(r => r.Id == transactionTypeId.Id).FirstOrDefault();

            if (transactionType == null)
            {
                throw TransactionException.BuildException(TransactionException.ErrorCode.TransactionTypeNotFound);
            }

            var transaction = service.NewTransaction(executionContext, session, transactionContext, transactionType);

            IUIPointer uiPointer = null;

            if (transaction.CurrentStep.Type.IsUIStep)
            {
                uiPointer = transaction.CurrentStep.GetUIPointer(executionContext, transaction);
            }

            if (uiPointer == null)
            {
                // When current step is not a UI step, navigate the process forward which will execute process steps
                // until a UI step is found or the process is blocked by a validation issue.
                var step = transaction.NavigateForward(session);
                if (step.Type.IsUIStep)
                {
                    uiPointer = step.GetUIPointer(executionContext, transaction);
                }
            }

            if (uiPointer == null)
            {
                // At this point something is wrong so navigate the user to the transaction error form.
                uiPointer = new UIPointer
                {
                    UIDefinition = "TransactionError",
                    UIRecordId   = transaction.Id,
                    UIRecordType = "ccllc_transaction",
                    UIType       = eUIStepTypeEnum.DataForm
                };
            }

            executionContext.Trace("Adding UI Pointer to output parameters.");
            executionContext.OutputParameters["UIPointer"] = uiPointer.Serialize();
        }
Exemplo n.º 27
0
 public void ReleasePointerToPool(UIPointer pointer)
 {
     pointer.Reset();
     this.activePointerList.Remove(pointer);
     this.pointerPool.Push(pointer);
 }