Ejemplo n.º 1
0
        public static void FireIfPossible()
        {
            if (_instance != null)
            {
                try
                {
                    NotificationMessageUI menu = _HUD.FindMenu <NotificationMessageUI>(false);
                    Program.Log("Menu = " + menu);
                    if (menu != null)
                    {
                        //confirm fire
                        // 0 = Button Ok
                        Program.InvokeMethod(typeof(NotificationMessageUI), menu, "CloseMessage", new object[] { 0 });
                    }
                    else
                    {
                        int i;
                        i = (int)StaffInspectButton.Fire;
                        bool canFire = _instance.IsFooterButtonVisible(i) && _instance.IsFooterButtonEnabled(i);

                        InspectorMenu imenu = _HUD.FindMenu <InspectorMenu>(false);
                        //Don't do stuff if inspect is hidden
                        if (imenu != null & canFire)
                        {
                            //treat. can't call private method directly
                            Program.InvokeMethod(typeof(InspectorDataStaff), _instance, "Fire");
                        }
                    }
                }
                catch (Exception e)
                {
                    Program.Error(e.ToString());
                }
            }
        }
Ejemplo n.º 2
0
        public static void SellRoom()
        {
            SelectMenuRoomItem smenu = _HUD.FindMenu <SelectMenuRoomItem>(false);

            if (smenu != null)
            {
                //sell item
                Program.InvokeMethod(typeof(SelectMenuRoomItem), smenu, "SellButton");
                return;
            }

            if (_instance != null)
            {
                try
                {
                    NotificationMessageUI menu = _HUD.FindMenu <NotificationMessageUI>(false);
                    Program.Log("Menu = " + menu);
                    if (menu != null)
                    {
                        //confirm sell
                        // 0 = Button Ok
                        Program.InvokeMethod(typeof(NotificationMessageUI), menu, "CloseMessage", new object[] { 0 });
                    }
                    else
                    {
                        InspectorMenu imenu = _HUD.FindMenu <InspectorMenu>(false);
                        //Don't do stuff if inspect is hidden
                        if (imenu != null & InspectorMenu.ShouldShowInspector(_room))
                        {
                            //show sell dialog
                            Program.InvokeMethod(typeof(InspectorDataRoom), _instance, "SellRoom");
                        }
                    }
                }
                catch (Exception e)
                {
                    Program.Error(e.ToString());
                }
            }
        }