Esempio n. 1
0
File: Gate.cs Progetto: MK4H/MHUrho
            public GateWindowInstance(GateWindow gateWindow)
            {
                this.gateWindow = gateWindow;
                var packageUI = ((LevelInstancePluginBase)Gate.Level.Plugin).PackageUI;

                packageUI.LoadLayoutToUI("Assets/UI/GateWindow.xml", "Assets/UI/UIStyle.xml");
                this.holder = packageUI.PackageRoot.GetChild("GateWindowHolder");
                this.window = (Window)holder.GetChild("GateWindow");

                this.hideButton = (Button)window.GetChild("HideButton");

                this.openButton  = (Button)window.GetChild("OpenButton", true);
                this.closeButton = (Button)window.GetChild("CloseButton", true);

                if (Gate.IsOpen)
                {
                    openButton.Enabled  = false;
                    closeButton.Enabled = true;
                }

                RegisterHandlers();
            }
Esempio n. 2
0
File: Gate.cs Progetto: MK4H/MHUrho
        public override void LoadState(PluginDataWrapper pluginData)
        {
            var reader = pluginData.GetReaderForWrappedSequentialData();

            reader.GetNext(out bool isOpen);
            healthBar = HealthBarControl.Load(Level, Building, reader);

            if (isOpen)
            {
                leftDoor.SetOpen();
                rightDoor.SetOpen();
            }
            else
            {
                leftDoor.SetClosed();
                rightDoor.SetClosed();
            }

            clicker          = Building.GetDefaultComponent <Clicker>();
            clicker.Clicked += OnClicked;
            window           = new GateWindow(this);

            CreatePathfindingNodes();
        }