Esempio n. 1
0
    void Start()
    {
        ClickCheckerCall        = GameObject.Find("BaseSystem").GetComponent <ClickChecker>();
        ValueCall               = GameObject.Find("BaseSystem").GetComponent <InGameValue>();
        TimeManagerCall         = GameObject.Find("TimeManager").GetComponent <TimeManager>();
        CompanyValueCall        = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue();
        NewsPanelControllerCall = NewsPanel.GetComponent <NewsPanelController>();

        PlayerCompanyName = CompanyValueCall.CompanyName;

        SidePanelManager();
        FloatingPanelManager();

        NewsPanelControllerCall.CallPanelController = this;

        AlertPopUpPanel.GetComponent <AlertPopUpPanelController>().CallPanelController = this;

        NoteToolTipPanel.GetComponent <NoteToolTipPanelController>().CallPanelController     = this;
        NoteToolTipPanel.GetComponent <NoteToolTipPanelController>().CallNotificationManager = GameObject.Find("NotificationManager").GetComponent <NotificationManager>();

        SetUIScale();
        Scaling();

        NewsPanelControllerCall.UpdateTimeText();
    }
Esempio n. 2
0
    void Awake()
    {
        PanelRect        = gameObject.GetComponent <RectTransform>();
        CallClickChecker = GameObject.Find("BaseSystem").GetComponent <ClickChecker>();

        isInitialize = false;
    }
Esempio n. 3
0
        public void OnMouseClick(object sender, EventArgs e)
        {
            ClickChecker clickChecker = new ClickChecker();

            if (!GameObjectManager.Instance.IsMessageBoxPopup)
            {
                OnMouseClickEvent?.Invoke(sender, clickChecker);
            }
            else
            {
                OnMouseClickToMessageBoxEvent?.Invoke(sender, clickChecker);
            }
        }
 // Use this for initialization
 void Start()
 {
     towerTransform          = GetComponent <Transform>();
     towerPostion            = towerTransform.position;
     towerRotation           = towerTransform.rotation;
     towerPostion.z          = towerPostion.y / 100; //Set Z position based on Y position
     towerTransform.position = towerPostion;
     towerExtents            = GetComponent <SpriteRenderer>().bounds.extents;
     controllerObject        = GameObject.Find("ControllerObject").GetComponent <ClickChecker>();
     clickedOnMe             = false;
     updateList     = false;
     createNewTower = false;
 }
Esempio n. 5
0
        private void OnMouseClick(object sender, ClickChecker checker)
        {
            if (IsActive == false)
            {
                return;
            }

            if (Range.IsMouseOver(Vector3.TransformCoordinate(Vector3.Zero, GetWorldMatrix()), FieldTexture))
            {
                IsSelected = true;
            }
            else
            {
                IsSelected = false;
            }
        }
        public void MouseDown(object sender, MouseEventArgs e)
        {
            var     point = new Vertex(e.X, e.Y);
            Polygon polygon;
            Vertex  vertex;
            var     wasVertexClicked = ClickChecker.WasVertexClicked(point, MainForm.Polygons, out vertex, out polygon);

            if (!Moving && wasVertexClicked && e.Button == MouseButtons.Left)
            {
                Vertex  = vertex;
                Polygon = polygon;
                Moving  = true;
            }
            else if (Moving && e.Button == MouseButtons.Left)
            {
                Moving = false;
                MainForm.CurrentState = new IdleState(MainForm);
            }
        }
Esempio n. 7
0
    // Start is called before the first frame update
    void Start()
    {
        isInstall               = false;
        BaseSystem              = GameObject.Find("BaseSystem");
        ValueCall               = BaseSystem.GetComponent <InGameValue>();
        PanelControllerCall     = GameObject.Find("Canvas").GetComponent <PanelController>();
        ClickCheckerCall        = BaseSystem.GetComponent <ClickChecker>();
        GroupActivationCall     = BaseSystem.GetComponent <GroupActivation>();
        TimeManagerCall         = GameObject.Find("TimeManager").GetComponent <TimeManager>();
        EconomyValueCall        = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue().GetEconomyValue().GetComponent <EconomyValue>();
        NotificationManagerCall = GameObject.Find("NotificationManager").GetComponent <NotificationManager>();
        CompanyValueCall        = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue();
        WorkSpeed               = 1f;
        IsWorking               = false;

        GetWholeStructObject();
        GetOriginalStructColor();
        CheckInstallCondition();
    }
Esempio n. 8
0
        public void MouseDown(object sender, MouseEventArgs e)
        {
            Polygon polygon;
            var     point = new Vertex(e.X, e.Y);

            if (!ClickChecker.WasPolygonClicked(point, MainForm.Polygons, out polygon))
            {
                return;
            }

            Polygons.Add(polygon);
            MainForm.Render();
            if (Polygons.Count != 2)
            {
                return;
            }

            Intersection();
            this.Polygons.Clear();
            MainForm.Render();
            MainForm.CurrentPolygon = new Polygon();
            MainForm.CurrentState   = new IdleState(MainForm);
        }
Esempio n. 9
0
        public void OnClick(object sender, ClickChecker checker)
        {
            if (IsActive == false)
            {
                return;
            }

            if (checker.IsEndCheck == true)
            {
                if (IsAllowDuplicateClick == false)
                {
                    return;
                }
            }

            bool isMouseInside =
                rectCollider.IsMouseOver(Vector3.TransformCoordinate(-ButtonTexture.Center, GetWorldMatrix()));

            if (isMouseInside)
            {
                checker.IsEndCheck = true;
                OnButtonClick?.Invoke(this, EventArgs.Empty);
            }
        }
Esempio n. 10
0
    // Start is called before the first frame update
    void Awake()
    {
        CallClickChecker = GameObject.Find("BaseSystem").GetComponent <ClickChecker>();

        isInitialize = false;
    }
Esempio n. 11
0
        public void MouseDown(object sender, MouseEventArgs e)
        {
            var     clickedVertex = new Vertex(0, 0);
            Segment segment;
            Polygon polygon;
            var     point            = new Vertex(e.X, e.Y);
            var     wasEdgeClicked   = ClickChecker.WasEdgeClicked(point, MainForm.Polygons, out segment, out polygon);
            var     wasVertexClicked = false;

            if (!wasEdgeClicked)
            {
                wasVertexClicked = ClickChecker.WasVertexClicked(point, MainForm.Polygons, out clickedVertex, out polygon);
            }
            else
            {
                MainForm.CurrentPolygon = polygon;
                MainForm.CurrentSegment = segment;
                CurrentSegment          = segment;
                CurrentPolygon          = polygon;
            }

            // Context Menu
            if (e.Button == MouseButtons.Right)
            {
                MainForm.SetContextMenuItems(segment);

                if (wasEdgeClicked)
                {
                    MainForm.RelationContextMenu.Show(MainForm, new Point(point.X, point.Y));
                }
                else
                {
                    MainForm.PolygonContextMenu.Show(MainForm, new Point(point.X, point.Y));
                }
            }
            // Vertex deletion
            else if (!DeletingPolygon && wasVertexClicked && (Control.ModifierKeys == Keys.Control && e.Button == MouseButtons.Left))
            {
                if (polygon.Vertices.Count == 3)
                {
                    MainForm.Polygons.Remove(polygon);
                    MainForm.Render();
                    return;
                }
                var adjacentPoints = ClickChecker.FindAdjacentPoints(clickedVertex, polygon);
                polygon.Vertices.Remove(clickedVertex);
                var edgeToAddAfter = polygon.Segments.First(line => line.From == clickedVertex || line.To == clickedVertex);
                polygon.Segments.AddAfter(polygon.Segments.Find(edgeToAddAfter), new Segment(adjacentPoints[0], adjacentPoints[1]));
                polygon.Segments = new LinkedList <Segment>(polygon.Segments.Where((line) => line.From != clickedVertex && line.To != clickedVertex));
                CurrentPolygon   = polygon;

                MainForm.Render();
            }
            // Polygon deletion
            else if (DeletingPolygon && (wasEdgeClicked || wasVertexClicked) && e.Button == MouseButtons.Left)
            {
                MainForm.Polygons.Remove(polygon);
                if (polygon == MainForm.CurrentPolygon)
                {
                    MainForm.CurrentPolygon = new Polygon();
                }

                MainForm.Render();
                DeletingPolygon = false;
            }
            // Vertex addition in the middle of an edge
            else if (!DeletingPolygon && wasEdgeClicked && e.Button == MouseButtons.Left)
            {
                var midPoint = new Vertex(Math.Min(segment.From.X, segment.To.X) + Math.Abs(segment.From.X - segment.To.X) / 2,
                                          Math.Min(segment.From.Y, segment.To.Y) + Math.Abs(segment.From.Y - segment.To.Y) / 2);

                polygon.Segments.AddBefore(polygon.Segments.Find(segment), new Segment(segment.From, midPoint));
                polygon.Segments.AddBefore(polygon.Segments.Find(segment), new Segment(midPoint, segment.To));
                polygon.Segments.Remove(segment);

                polygon.Vertices.AddAfter(polygon.Vertices.Find(segment.From), midPoint);

                MainForm.Render();
            }
            // Vertex move
            else if (!DeletingPolygon && wasVertexClicked && polygon.Vertices.First.Value != clickedVertex && e.Button == MouseButtons.Left)
            {
                MainForm.RelationContextMenu.ItemClicked -= RelationContextMenu_ItemClicked;
                MainForm.PolygonContextMenu.ItemClicked  -= PolygonContextMenu_ItemClicked;
                MainForm.CurrentState = new VertexMoveState(MainForm, polygon, clickedVertex);
            }
        }