/// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IDefault page)
        {
            HoverManager m = new HoverManager();

            StreamLoremIpsum(Native.Document.body);

            new HoverElement("this is a hover text 1", m).AttachTo(Native.Document.body);

            StreamLoremIpsum(Native.Document.body);

            new HoverElement("this is a hover text 2", m).AttachTo(Native.Document.body);

            StreamLoremIpsum(Native.Document.body);

            new HoverElement("this is a hover text 3", m).AttachTo(Native.Document.body);

            StreamLoremIpsum(Native.Document.body);




            @"Hello world".ToDocumentTitle();
            // Send data from JavaScript to the server tier
            service.WebMethod2(
                @"A string from JavaScript.",
                value => value.ToDocumentTitle()
            );
        }
Esempio n. 2
0
        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IDefault page)
        {
            HoverManager m = new HoverManager();

            StreamLoremIpsum(Native.Document.body);

            new HoverElement("this is a hover text 1", m).AttachTo(Native.Document.body);

            StreamLoremIpsum(Native.Document.body);

            new HoverElement("this is a hover text 2", m).AttachTo(Native.Document.body);

            StreamLoremIpsum(Native.Document.body);

            new HoverElement("this is a hover text 3", m).AttachTo(Native.Document.body);

            StreamLoremIpsum(Native.Document.body);



            @"Hello world".ToDocumentTitle();
            // Send data from JavaScript to the server tier
            service.WebMethod2(
                @"A string from JavaScript.",
                value => value.ToDocumentTitle()
                );
        }
Esempio n. 3
0
    // *********** //
    // ** Initialisation ** //
    // *********** //

    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
    }
Esempio n. 4
0
 public void Awake()
 {
     if (main == null)
     {
         main = this;
     }
 }
 public PropertiesGridControlViewModel()
 {
     _source = new PGSourceStub();
     _hoverManager = new HoverManager(this);
     _items = new ItemViewModel[0];
     _rows = new RowViewModel[0];
     _columns = new ColumnViewModel[0];
     _props = new RowProperty[0];
 }
    private void Awake()
    {
        if (!gameStart)
        {
            //Check if we are making the instance in the awake function
            if (instance != null)
            {
                Debug.LogWarning("A pre-existing instance of hover manager has been found.");
                return;
            }
            instance = this;

            gameStart = true;
        }
    }
Esempio n. 7
0
 void Start()
 {
     //loads neccessary Managers
     if (GameObject.Find("ItemHoverer") != null)
     {
         AccHM = GameObject.Find("ItemHoverer").GetComponent <HoverManager>();
     }
     if (GameObject.Find("InventoryWindow") != null)
     {
         AccInv = GameObject.Find("InventoryWindow").GetComponent <InventoryManager>();
     }
     if (GameObject.Find("ShopWindow") != null)
     {
         AccShop = GameObject.Find("ShopWindow").GetComponent <ShopManager>();
     }
     if (GameObject.Find("EquipmentWindow") != null)
     {
         AccEq = GameObject.Find("EquipmentWindow").GetComponent <EquipmentManager>();
     }
 }
Esempio n. 8
0
        public HoverElement(string text, HoverManager m)
        {
            TextContent.nodeValue = text;

            Manager = m;

            ElementHeader.appendChild(Image, TextContent);
            ElementHeader.style.cursor = IStyle.CursorEnum.pointer;

            Element.appendChild(ElementHeader);

            Element.style.position         = IStyle.PositionEnum.relative;
            ElementHeader.style.fontWeight = "bold";
            Element.style.padding          = "2px";

            ImageStan.style.cursor = IStyle.CursorEnum.help;

            ImageStan.onclick +=
                delegate
            {
                Fader.FadeAndRemove(ImageStan, 9000, 400);

                Application.StreamLoremIpsum(Element);

                Element.style.width    = "400px";
                Element.style.overflow = IStyle.OverflowEnum.hidden;
            };

            Native.Document.body.onmousedown
                += e =>
                {
                bool b = IsNodeOrChildOfNode(ElementHeader, e.Element);

                if (b && !bDead)
                {
                    if (!isClone)
                    {
                        Clone();
                    }

                    Element.style.backgroundColor = Color.Black;
                    Element.style.color           = Color.White;
                    Element.style.Opacity         = 0.5;

                    bISDragging = true;

                    Element.SetCenteredLocation(e.CursorX, e.CursorY);

                    e.CaptureMouse();
                    //e.PreventDefault();
                    //e.StopPropagation();

                    Element.parentNode.appendChild(Element);
                }
                };

            Native.Document.onmouseup
                += delegate(IEvent e)
                {
                if (bISDragging)
                {
                    Element.style.backgroundColor = Color.White;
                    Element.style.color           = Color.Black;


                    bISDragging           = false;
                    Element.style.Opacity = 1;


                    bDead = !(--cTTL > 0);

                    if (bDead)
                    {
                        Fader.FadeAndRemove(Element);
                    }

                    e.preventDefault();
                    e.stopPropagation();
                }
                };

            Native.Document.onmousemove +=
                delegate(IEvent e)
            {
                if (bISDragging)
                {
                    Element.SetCenteredLocation(e.CursorX, e.CursorY);

                    e.preventDefault();
                    e.stopPropagation();
                }
            };

            Element.oncontextmenu +=
                delegate(IEvent e)
            {
                e.preventDefault();
            };

            Element.onmouseover +=
                delegate
            {
                if (!bDead && !bISDragging)
                {
                    ElementHeader.style.color = Color.Red;
                }
            };

            Element.onmouseout +=
                delegate
            {
                if (!bDead && !bISDragging)
                {
                    ElementHeader.style.color = "";
                }
            };
        }
        public HoverElement(string text, HoverManager m)
        {



            TextContent.nodeValue = text;

            Manager = m;

            ElementHeader.appendChild(Image, TextContent);
            ElementHeader.style.cursor = IStyle.CursorEnum.pointer;

            Element.appendChild(ElementHeader);

            Element.style.position = IStyle.PositionEnum.relative;
            ElementHeader.style.fontWeight = "bold";
            Element.style.padding = "2px";

            ImageStan.style.cursor = IStyle.CursorEnum.help;

            ImageStan.onclick +=
                delegate
                {
                    Fader.FadeAndRemove(ImageStan, 9000, 400);

                    Application.StreamLoremIpsum(Element);

                    Element.style.width = "400px";
                    Element.style.overflow = IStyle.OverflowEnum.hidden;
                };

            Native.Document.body.onmousedown
                += e =>
                {
                    bool b = IsNodeOrChildOfNode(ElementHeader, e.Element);

                    if (b && !bDead)
                    {
                        if (!isClone)
                        {
                            Clone();
                        }

                        Element.style.backgroundColor = Color.Black;
                        Element.style.color = Color.White;
                        Element.style.Opacity = 0.5;

                        bISDragging = true;

                        Element.SetCenteredLocation(e.CursorX, e.CursorY);

                        e.CaptureMouse();
                        //e.PreventDefault(); 
                        //e.StopPropagation();

                        Element.parentNode.appendChild(Element);

                    }
                };

            Native.Document.onmouseup
                += delegate(IEvent e)
                {
                    if (bISDragging)
                    {
                        Element.style.backgroundColor = Color.White;
                        Element.style.color = Color.Black;


                        bISDragging = false;
                        Element.style.Opacity = 1;


                        bDead = !(--cTTL > 0);

                        if (bDead)
                            Fader.FadeAndRemove(Element);

                        e.preventDefault();
                        e.stopPropagation();
                    }
                };

            Native.Document.onmousemove +=
                delegate(IEvent e)
                {
                    if (bISDragging)
                    {
                        Element.SetCenteredLocation(e.CursorX, e.CursorY);

                        e.preventDefault();
                        e.stopPropagation();


                    }
                };

            Element.oncontextmenu +=
                delegate(IEvent e)
                {
                    e.preventDefault();
                };

            Element.onmouseover +=
                delegate
                {
                    if (!bDead && !bISDragging)
                        ElementHeader.style.color = Color.Red;
                };

            Element.onmouseout +=
                delegate
                {
                    if (!bDead && !bISDragging)
                        ElementHeader.style.color = "";
                };
        }
Esempio n. 10
0
	// Use this for initialization
	void Start () 
	{
		if(GetComponent<UIButton3D>() != null)
			GetComponent<UIButton3D>().SetInputDelegate(onInput);
		_hoverManager = GameObject.FindGameObjectWithTag("HoverManager").GetComponent<HoverManager>();
	}
Esempio n. 11
0
    //------------------------------Mouse Button Handler------------------------------
    private void MouseClickedHandler(MouseClickEventArgs e)
    {
        SelectedManager selectedManager = SelectedManager.main;
        DragManager     dragManager     = DragManager.main;
        HoverManager    hoverManager    = HoverManager.main;
        RTSGameObject   hoverRTS        = hoverManager.getHoverRTSGameObject();

        //Place building
        if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Up)
        {
            if (gameMode == GameMode.PlaceBuilding)
            {
                if (!readyToPlaceBuilding)                      //Ready to place the building
                {
                    readyToPlaceBuilding = true;
                }
                else if (canPlaceBuilding)                      //Place the building
                //Debug.Log("Building placed");

                {
                    readyToPlaceBuilding = false;
                    gameMode             = GameMode.Normal;
                    buildingReadyToPlace.GetComponent <Building>().buildingMode = BuildingMode.Construction;
                    buildingReadyToPlace.GetComponent <Building>().objectBase.GetComponent <MeshRenderer>().material = TeamManager.main.player1.matColor;                       //Set building base to team material color

                    foreach (RTSGameObject rtsGameObject in selectedManager.GetSelectedObjects())
                    {
                        Worker worker = rtsGameObject.GetComponent <Worker>();
                        if (worker)
                        {
                            //worker.TravelToPath(buildingReadyToPlace.transform.position);
                            worker.BuildBuilding(buildingReadyToPlace.GetComponent <Building>());
                        }
                    }
                }
                else
                {
                    Debug.Log("Cant place building here");
                }
            }
        }



        //Drag select the RTSGameObjects
        if (dragManager.isDragging)
        {
            if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Down)
            {
                //Note: This will never run because you can start dragging on the first click. There is a threshold.
            }
            if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Holding)
            {
                selectedManager.DeselectAllObjects();
                foreach (RTSGameObject rtsGameObject in RTSGameObject.allRTSGameObjects)
                {
                    if (TeamManager.main.player1.IsRTSAlly(rtsGameObject))
                    {
                        if (rtsGameObject.unitType == UnitType.Unit)
                        {
                            if (dragManager.IsWithinDragBox(rtsGameObject.transform.position))
                            {
                                dragManager.SelectObject(rtsGameObject);
                                //selectedManager.SelectObject(rtsGameObject);

                                rtsGameObject.OnHoverDrag();
                            }
                            else
                            {
                                dragManager.DeselectObject(rtsGameObject);
                                //selectedManager.DeselectObject(rtsGameObject);
                            }
                        }
                    }
                }
            }
            if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Up)
            {
                //Note: This will never run because dragManager.isDragging will be false when the button is up.
            }
        }
        else if (dragManager.selectedObjects.Count > 0)
        {
            //Select the drag group and clear the drag selection
            SelectedManager.main.SelectObject(dragManager.selectedObjects);
            dragManager.selectedObjects.Clear();
        }



        //Select the RTSGameObjects
        else if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Up)
        {
            if (gameMode == GameMode.Normal)                    //Make sure not to deselect the RTSGameObject while in any other mode (ex. HUD clicking)
            {
                if (hoverManager.isHoverRTSObject)              //If you are hovering over a RTSGameObject

                {
                    if (TeamManager.main.player1.IsRTSAlly(hoverRTS))                      //Is this RTS friendly
                    {
                        if (hoverRTS.unitType == UnitType.Unit)                            //Is this RTS a Unit
                        {
                            if (IsShiftDown)
                            {
                                selectedManager.SelectObject(hoverRTS);
                            }
                            else
                            {
                                selectedManager.DeselectAllObjects();
                                selectedManager.SelectObject(hoverRTS);
                            }
                        }
                        else if (hoverRTS.unitType == UnitType.Building)                            //Is this RTS a Building
                        {
                            if (selectedManager.GetSelectedObjectsCount() == 0)                     //If you have nothing selected
                            {
                                selectedManager.SelectObject(hoverRTS);
                            }
                        }
                    }

                    if (TeamManager.main.player1.IsRTSEnemy(hoverRTS))
                    {
                        if (hoverRTS.unitType == UnitType.Unit)
                        {
                            //Debug.Log("You cant select a enemy unit");
                        }
                        else if (hoverRTS.unitType == UnitType.Building)
                        {
                            //Debug.Log("You cant select a enemy building");
                        }
                    }
                }
                else
                {
                    selectedManager.DeselectAllObjects();
                }
            }
        }
    }