public ToggleServices(PanelMain plMain, Vector3 m_startPosition, Vector3 m_mousePosition)
 {
     this.plMain = plMain;
     this.m_startPosition = m_startPosition;
     this.m_mousePosition = m_mousePosition;
 }
Exemplo n.º 2
0
        public void InitGui(LoadMode _mode, Chirper chirp, UnlockRoads roads)
        {
            WriteLog("Entering InitGUI");
            mode = _mode;
            //store a local copy of each mod
            Chirp = chirp;
            Roads = roads;

            mainButton = UIView.GetAView().FindUIComponent<UIButton>("MarqueeBulldozer");

            if (mainButton == null)
            {
                var RoadUpdateButton = UIView.GetAView().FindUIComponent<UIMultiStateButton>("BulldozerButton");

                mainButton = RoadUpdateButton.parent.AddUIComponent<UIButton>();
                mainButton.name = "AnotherRoadUpdateTool";
                mainButton.size = new Vector2(40, 40);
                mainButton.tooltip = "Another Road Update tool";
                mainButton.relativePosition = new Vector2
                (
                    RoadUpdateButton.relativePosition.x + RoadUpdateButton.width / 2.0f - (mainButton.width * 2) - RoadUpdateButton.width,
                    RoadUpdateButton.relativePosition.y + RoadUpdateButton.height / 2.0f - mainButton.height / 2.0f
                );

                mainButton.normalFgSprite = RoadUpdateButton.normalFgSprite;
                mainButton.focusedFgSprite = RoadUpdateButton.focusedFgSprite;
                mainButton.hoveredFgSprite = RoadUpdateButton.hoveredFgSprite;

                mainButton.eventClick += Button_Clicked;

                WriteLog("About to set PanelMain in InitGUI");
                GameObject go = new GameObject("buildingWindowObject");

                plMain = go.AddComponent<PanelMain>();

                var view = UIView.GetAView();

                plMain.Mode = mode;
                plMain.transform.parent = view.transform;
                plMain.isVisible = true;
                //plMain.canFocus = true;
                //plMain.isInteractive = true;
                //plMain.relativePosition = new Vector3(572, 525);

                plMain.backgroundSprite = "MenuPanel2";

                plMain.eventPositionChanged += PlMain_eventPositionChanged;
                plMain.CreateObjects();

                //WriteLog("About to set GetSettings in InitGUI");
                //We can load the users last session
                GetSettings();
                //we can set to top, left based on the last position
                WriteLog("plMain us.Left, us.Top: " + us.Left + "x" + us.Top);
                plMain.relativePosition = new Vector3(us.Top, us.Left);
                WriteLog("plMain relativePosition: " + plMain.relativePosition);
                WriteLog("plMain Position: " + plMain.position);

                plMain.RefreshView();

                //WriteLog("About to set Areas and Zones in InitGUI");

                //About to set unlockable tiles
                Areas = new MaxAreas();
                Zones = new Zones();
                UndoList = new BindingList<UndoStroke>();
                Dozer = new DestroyMonitor();
                //WriteLog("Leaving InitGUI");
            }
        }