Exemple #1
0
        public Housemate(
            [RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
            [RequiredVersion("1.0")] CommandManager commandManager,
            [RequiredVersion("1.0")] DataManager dataManager,
            [RequiredVersion("1.0")] ObjectTable objectTable,
            [RequiredVersion("1.0")] ClientState clientState,
            [RequiredVersion("1.0")] GameGui gameGui,
            [RequiredVersion("1.0")] SigScanner sigScanner)
        {
            _pi             = pluginInterface;
            _commandManager = commandManager;

            _configuration = _pi.GetPluginConfig() as Configuration ?? new Configuration();
            _configuration.Initialize(_pi);
            _ui = new HousemateUI(_configuration, objectTable, clientState, gameGui);

            commandManager.AddHandler(CommandName, new CommandInfo(OnCommand)
            {
                HelpMessage = $"Display the Housemate configuration interface.\n" +
                              $"Toggle the Housemate object overlay with '{CommandName} toggle'"
            });

            HousingData.Init(dataManager);
            HousingMemory.Init(sigScanner);

            _pi.UiBuilder.Draw         += DrawUI;
            _pi.UiBuilder.OpenConfigUi += DrawConfigUI;
        }
Exemple #2
0
 public MapLinker(
     DalamudPluginInterface pluginInterface,
     ChatGui chat,
     CommandManager commands,
     DataManager data,
     ClientState clientState,
     Framework framework,
     GameGui gameGui,
     TargetManager targetManager)
 {
     Interface      = pluginInterface;
     ClientState    = clientState;
     TargetManager  = targetManager;
     Framework      = framework;
     CommandManager = commands;
     DataManager    = data;
     ChatGui        = chat;
     GameGui        = gameGui;
     Aetherytes     = DataManager.GetExcelSheet <Aetheryte>(ClientState.ClientLanguage);
     AetherytesMap  = DataManager.GetExcelSheet <MapMarker>(ClientState.ClientLanguage);
     Config         = pluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
     Config.Initialize(pluginInterface);
     CommandManager.AddHandler("/maplink", new CommandInfo(CommandHandler)
     {
         HelpMessage = "/maplink - open the maplink panel."
     });
     Gui = new PluginUi(this);
     ChatGui.ChatMessage += Chat_OnChatMessage;
 }
Exemple #3
0
        public Framework(SigScanner scanner, Dalamud dalamud)
        {
            Address = new FrameworkAddressResolver();
            Address.Setup(scanner);

            Log.Verbose("Framework address {FrameworkAddress}", Address.BaseAddress);
            if (Address.BaseAddress == IntPtr.Zero)
            {
                throw new InvalidOperationException("Framework is not initalized yet.");
            }

            // Hook virtual functions
            HookVTable();

            // Initialize subsystems
            Libc = new LibcFunction(scanner);

            Gui = new GameGui(Address.GuiManager, scanner, dalamud);

            Network = new GameNetwork(dalamud, scanner);

            //Resource = new ResourceManager(dalamud, scanner);

            this.antiDebug = new AntiDebug();
        }
        public void InvokeSoftDispose()
        {
            IsPlaying = false;
            IsPaused  = false;

            int playTime = GetPlayTime();

            // Stop listening to app pause event.
            Game.OnAppPause -= OnAppPaused;
            Game.OnAppFocus -= OnAppFocused;

            // Record score if not replay mode.
            if (!CurrentParameter.IsReplay)
            {
                var listener = new TaskListener <IRecord>();
                listener.OnFinished += (record) =>
                {
                    ScoreProcessor = null;
                    GameGui.HideGame(() => OnSoftDispose?.Invoke());
                };
                Model?.RecordScore(ScoreProcessor, playTime, listener);
            }
            else
            {
                GameGui.HideGame(() => OnSoftDispose?.Invoke());
            }
        }
Exemple #5
0
        public void PlaceMapMarker(MapLinkMessage maplinkMessage)
        {
            Log($"Viewing {maplinkMessage.Text}");
            var map     = DataManager.GetExcelSheet <TerritoryType>().GetRow(maplinkMessage.TerritoryId).Map;
            var maplink = new MapLinkPayload(maplinkMessage.TerritoryId, map.Row, maplinkMessage.X, maplinkMessage.Y);

            GameGui.OpenMapWithMapLink(maplink);
        }
Exemple #6
0
        /// <summary>
        /// Create a new UiBuilder and register it. You do not have to call this manually.
        /// </summary>
        /// <param name="interfaceManager">The interface manager to register on.</param>
        /// <param name="namespaceName">The plugin namespace.</param>
        internal UiBuilder(InterfaceManager interfaceManager, GameGui gameGui, DalamudConfiguration config, string namespaceName)
        {
            this.namespaceName = namespaceName;

            this.interfaceManager         = interfaceManager;
            this.gameGui                  = gameGui;
            this.config                   = config;
            this.interfaceManager.OnDraw += OnDraw;
            this.stopwatch                = new System.Diagnostics.Stopwatch();
        }
Exemple #7
0
    void Start()
    {
        state = State.Start;

        display = GetComponent <DisplayScript>();
        display.StartDisplay();

        myGui = GetComponent <GameGui>();
        myGui.showStart();
    }
Exemple #8
0
        public void Start()
        {
            CopyDefaultWave();
            // storeSystem = FindObjectOfType<StoreSystem> ();
            //storeSystem.ToogleStore (false);
            gameGui = GameObject.FindObjectOfType <GameGui> ();

            Enemy.onEnemyDeath += DecreseEnemiesCount;

            NextWave();
        }
Exemple #9
0
        /// <summary>
        /// Initializes the game processor instance.
        /// </summary>
        private void InitGameProcessor()
        {
            if (CurrentParameter.IsReplay)
            {
                gameProcessor = GameGui.CreateChild <ReplayGameProcessor>();
            }
            else
            {
                gameProcessor = GameGui.CreateChild <LocalGameProcessor>();
            }

            Dependencies.Cache(gameProcessor);
        }
Exemple #10
0
    public Plugin(
        DalamudPluginInterface pi
        , SigScanner sigScanner
        , ClientState clientState
        , CommandManager commands
        , Condition condition
        , TargetManager targetManager
        , [RequiredVersion("1.0")] GameGui gameGui
        )
    {
        _pluginInterface = pi;
        _config          = GetAndMigrateConfig(pi);
        _clientState     = clientState;
        _commands        = commands;
        _compass         = new Compass(
            condition,
            targetManager,
            gameGui,
            _config
            );

        _clientState.Login  += OnLogin;
        _clientState.Logout += OnLogout;

        _commands.AddHandler(Command, new CommandInfo(CommandHandler)
        {
            HelpMessage =
                string.Format(i18n.command_help_text, PluginName, Command),
            ShowInHelp = true
        });

        DebugCtor(sigScanner);
        if (_pluginInterface.Reason == PluginLoadReason.Installer)
        {
            // NOTE: Centers compass on first install
            SimpleLog.Information("Fresh install of Compass; centering compass, drawing modal.");
            var screenSizeCenterX = (ImGuiHelpers.MainViewport.Size * 0.5f).X;
            _config.ImGuiCompassPosition = _config.ImGuiCompassPosition with {
                X = screenSizeCenterX - _config.ImGuiCompassWidth * 0.5f
            };
            _buildingConfigUi                = true;
            _config.FreshInstall             = true;
            _pluginInterface.UiBuilder.Draw += DrawConfigUi;
        }

        if (_clientState.LocalPlayer is not null)
        {
            OnLogin(null !, null !);
        }
    }
Exemple #11
0
        private void Awake()
        {
            List <Transform> targets = new List <Transform> (); // create new list

            for (int i = 0; i < WorldData.NumberOfPlayers; i++) // instatiate new players...
            {
                GameObject player = Instantiate(players[i], playerSpawnPoint.position + new Vector3(i * 5, 0, 0), Quaternion.identity);

                PlayerDatabase.Instance.AddWeapon(player, i);
                PlayerDatabase.Instance.AddShield(player, i);

                targets.Add(player.transform);
            }
            var CamF = GameObject.FindObjectOfType <CameraFollow> ();

            CamF.SetTransformTargets(targets);                  // Set targets to camera follow

            GAME_GUI = GameObject.FindObjectOfType <GameGui>(); // FIND game gui panel on map
        }
    public void MoveTo(Vector3 mousePosition)
    {
        if (m_Agent == null || m_Agent.IsCanMove() == false)
        {
            return;
        }
        if (GameGui.IsIgnoreMouse(mousePosition))
        {
            return;
        }
        if (Camera.main == null || !Camera.main.isActiveAndEnabled)
        {
            return;
        }
        Ray ray = Camera.main.ScreenPointToRay(mousePosition);

        if (coll.Raycast(ray, out m_HitInfo, 1000))
        {
            var r = m_HitInfo.point;
            m_Agent.NavMeshAgent.SetDestination(r);
        }
    }
        public static bool Show(GuiDefinitions.Callback callback, string title, string text)
        {
            GameState gameState = GameManager.getInstance().getGameState();

            if (gameState is GameStateGame)
            {
                GuiGameOverWindow window        = new GuiGameOverWindow(callback, title, text);
                GameStateGame     gameStateGame = (GameStateGame)gameState;
                FieldInfo         mGameGuiInfo  = Reflection.GetPrivateFieldOrThrow(gameStateGame.GetType(), "mGameGui", true);
                GameGui           mGameGui      = (GameGui)Reflection.GetInstanceFieldValue(gameStateGame, mGameGuiInfo);
                mGameGui.setWindow(window);
                return(true);
            }

            if (gameState is GameStateMultiplayer)
            {
                GameStateMultiplayer gameStateMultiplayer = (GameStateMultiplayer)gameState;
                gameStateMultiplayer.ShowMessageBox(callback, title, text);
                return(true);
            }

            // Not supported
            return(false);
        }
        public void InvokeSoftInit()
        {
            // Initialize score processor
            ScoreProcessor = Model.ModeService.CreateScoreProcessor();
            ScoreProcessor.ApplyMap(CurrentMap);
            ScoreProcessor.OnLastJudgement += InvokeCompletion;

            MusicController.Stop();
            MusicController.SetFade(1f);

            // Show game gui.
            GameGui.ShowGame(() =>
            {
                MusicController.Play(LeadInTime);

                // Start listening to application pause event.
                Game.OnAppPause += OnAppPaused;
                Game.OnAppFocus += OnAppFocused;

                IsPlaying = true;

                OnSoftInit?.Invoke();
            });
        }
Exemple #15
0
	void Awake()
	{		
		_instance = this;
		DontDestroyOnLoad(gameObject);	
	}
    public void OnGUIDebug(TilesetAON tilesetAON)
    {
        if (!mShowDebug)
        {
            var rectBt = new Rect(8, Screen.height - 8 - DefineAON.GUI_Height_Button, 60, DefineAON.GUI_Height_Button);
            GameGui.SetRectIgnore(rectBt);
            AONGUI.Button(rectBt, "Debug", () => {
                mShowDebug = true;
            });
            return;
        }
        float w           = 380;
        float limitHeight = 350;
        Rect  rect        = new Rect(8, Screen.height - limitHeight - 8, w, limitHeight);

        AONGUI.Box(rect, "");
        GameGui.SetRectIgnore(rect);
        string[] d = ScriptGui.StrFlagTarget;
        int      current_target = (int)mTabFlagDebug;

        rect.x     = rect.x + 8f;
        rect.width = rect.width - 16f;
        AONGUI.SelectionGrid(new Rect(rect.x, rect.y + 6, rect.width, 26), current_target, d, d.Length, tilesetAON.ListStyleGrid, (int next) => {
            mTabFlagDebug = (ScriptGui.FlagTarget)next;
        });

        rect.y      = rect.y + 32f;
        rect.height = rect.height - 64f;
        if (mTabFlagDebug == ScriptGui.FlagTarget.World)
        {
            FlagGui.OnGuiDebug(WorldFlag, rect, limitHeight);
        }
        else if (mTabFlagDebug == ScriptGui.FlagTarget.Map)
        {
            int mapIdx = AutoTileMap_Editor.Instance.MapIdxSelect;
            FlagGui.OnGuiDebug(MapFlag(mapIdx), rect, limitHeight);
        }
        else          //mFlagDebug == ScriptGui.FlagTarget.Script
        {
            if (IsScriptMainRunning)
            {
                FlagGui.OnGuiDebug(ScriptMain.Flags, rect, limitHeight);
            }
            else
            {
                AONGUI.Label(new Rect(rect.x, rect.y + DefineAON.GUI_Y_Label, 150, DefineAON.GUI_Height_Label), "No script target");
            }
        }
        float yGui = Screen.height - 36;
        float xGui = 12;
        {
            var rectBt = new Rect(xGui, yGui, 50, 24);
            AONGUI.Button(rectBt, "Hide", () => {
                mShowDebug = false;
            });
            xGui += 54;
        }
        {
            var rectBt = new Rect(xGui, yGui, 50, 24);
            AONGUI.Button(rectBt, AutoTileMap_Editor.Instance.DayNight.Hour.ToString() + "h +1", () => {
                AutoTileMap_Editor.Instance.UpdateTime1Hour();
            });
            xGui += 54;
        }
        {
            var rectBt = new Rect(xGui, yGui, 50, 24);
            AONGUI.Button(rectBt, "Base", () => {
                AutoTileMap_Editor.Instance.NextBase();
            });
            xGui += 54;
        }
        {
            var rectBt = new Rect(xGui, yGui, 50, 24);
            AONGUI.Button(rectBt, "Skin", () => {
                AutoTileMap_Editor.Instance.NextSkin();
            });
            xGui += 54;
        }
        {
            var rectBt = new Rect(xGui, yGui, 50, 24);
            AONGUI.Button(rectBt, "Cos", () => {
                AutoTileMap_Editor.Instance.NextCostume();
            });
            xGui += 54;
        }
        {
            var rectBt = new Rect(xGui, yGui, 100, 24);
            AONGUI.Toggle(rectBt, !AutoTileMap_Editor.Instance.CamControler.canControl, " Lock cam", (bool b) => {
                AutoTileMap_Editor.Instance.CamControler.canControl = b;
            });
            xGui += 104;
        }
    }
        // private TitleScreenMenu _titleScreenMenu;

        public TitleEditPlugin(
            [RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
            [RequiredVersion("1.0")] CommandManager commandManager,
            [RequiredVersion("1.0")] DataManager dataManager,
            [RequiredVersion("1.0")] ClientState clientState,
            [RequiredVersion("1.0")] Framework framework,
            [RequiredVersion("1.0")] KeyState keyState,
            [RequiredVersion("1.0")] SigScanner sigScanner,
            [RequiredVersion("1.0")] GameGui gameGui,
            [RequiredVersion("1.0")] TitleScreenMenu titleScreenMenu)
        {
            PluginLog.Log("===== T I T L E E D I T =====");
            _pluginInterface = pluginInterface;
            _commandManager  = commandManager;
            _dataManager     = dataManager;
            _clientState     = clientState;
            _framework       = framework;
            _keyState        = keyState;

            // Load menu_icon.png from dll resources
            var assembly       = Assembly.GetExecutingAssembly();
            var resourceStream = assembly.GetManifestResourceStream("TitleEdit.menu_icon.png");

            if (resourceStream != null)
            {
                var imageBytes = new byte[resourceStream.Length];
                resourceStream.Read(imageBytes, 0, (int)resourceStream.Length);
                PluginLog.Information($"image is {imageBytes.Length} bytes");
                try
                {
                    var image = pluginInterface.UiBuilder.LoadImage(imageBytes);
                    titleScreenMenu.AddEntry("Title Edit Menu", image, () => { _isImguiTitleEditOpen = true; });
                }
                catch (Exception e)
                {
                    PluginLog.Error(e, "Title Edit encountered an error loading menu icon");
                }
            }

            _commandManager.AddHandler(TitleEditCommand, new CommandInfo(OnTitleEditCommand)
            {
                HelpMessage = "Display the Title Edit configuration interface."
            });

            _configuration = pluginInterface.GetPluginConfig() as TitleEditConfiguration ?? new TitleEditConfiguration();
            _configuration.Initialize(pluginInterface);

            _titleScreenFolder = _pluginInterface.GetPluginConfigDirectory();
            if (!Directory.Exists(_titleScreenFolder))
            {
                Directory.CreateDirectory(_titleScreenFolder);
            }
            PrepareAssets();
            EnumerateTitleScreenFiles();

            _territoryPaths = dataManager.GetExcelSheet <TerritoryType>()
                              .ToDictionary(row => row.RowId, row => row);
            _weathers = dataManager.GetExcelSheet <Weather>()
                        .ToDictionary(row => row.RowId, row => row.Name.ToString());
            var bgms = dataManager.GetExcelSheet <BGM>()
                       .ToDictionary(row => (ushort)row.RowId, row => row.File.ToString());

            _bgmSheet = new BgmSheetManager(_titleScreenFolder, bgms);

            _titleEdit = new TitleEdit(sigScanner, clientState, gameGui, dataManager, _pluginInterface, _configuration, _titleScreenFolder);
            _titleEdit.Enable();

            _pluginInterface.UiBuilder.Draw += UiBuilder_OnBuildUi;
            _framework.Update += CheckHotkey;
            _pluginInterface.UiBuilder.OpenConfigUi += () => _isImguiTitleEditOpen = true;
            PluginLog.Log("Init complete.");
        }
Exemple #18
0
   void Start()
   {
      _poManagerState = PoManagerState.Normal;
      _shakingTimeLeft = PoBehaviour.PreRocketWarmUpTime;

      // Listen to global approve reject events, which we'll filter to make sure it's only the
      // one that applies to this PO
      GameManager.Instance.OnSinglePOApproved += OnSinglePOApproved;
      GameManager.Instance.OnSinglePORejected += OnSinglePORejected;

      // Highlighting - start stop movement when highlighted
      _scriptIsHighlightable = GetComponent<Highlight_IsHighlightable>();
      if (_scriptIsHighlightable != null)
      {
         _scriptIsHighlightable.OnHighlighted += OnHighlighted;
         _scriptIsHighlightable.OnUnhighlighted += OnUnhighlighted;
      }

      // Po GUI to display PO details
      _poGui = GetComponent<PoGui>();
      _poGui.enabled = false; // always start switched off

      // Game Gui, to tell it when we approve/reject
      GameObject go = GameObject.Find("GameGui");
      if (go != null)
      {
         _gameGui = go.GetComponent<GameGui>();
      }

      // Movement - get reference
      _poMover = GetComponent<PoMover>();

      // Delete mover for static POs
      if (_poMover != null && PoBehaviour.movementType == EpmPoMovementType.Static)
      {
         Component.Destroy(_poMover);
      }
   }
Exemple #19
0
    // Use this for initialization
    void Start()
    {
        print("PoFactory starting...");
          _factoryState = FactoryState.Idle;
          GameManager.Instance.OnSinglePODataWithItemsChanged += OnSinglePODataWithItemsChanged;
          GameManager.Instance.OnMassListPOChanged += OnMassListPOChanged;

          // Store any generator locations defined as child objects of the factory
          _generatorLocations = new List<GameObject>(2);
          foreach (Transform child in transform)
          {
         if (child.gameObject.name.StartsWith("Generator_"))
         {
            _generatorLocations.Add(child.gameObject);
         }
          }

          // Game Gui, to tell it when we create, andto listen to when a new wave asked for
          GameObject go = GameObject.Find("GameGui");
          if (go != null)
          {
         _gameGui = go.GetComponent<GameGui>();
         _gameGui.OnNewWaveRequested += OnNewWaveRequested;
          }

          // and we're off!
          DoProductionRun();
    }
Exemple #20
0
        static void Main(string[] args)
        {
            var context = InitializeGame();
            var game    = context.games.First(g => g.InProgress == true);

            game.InProgress = false;
            context.SaveChanges();
            var gui           = new GameGui();
            var allPlaying    = true;
            var index         = 0;
            var previousColor = "";

            for (int i = 1; i < game.Turn; i++)
            {
                index++;
                if (index > 4)
                {
                    index = 0;
                }
            }
            string[] colors         = new string[] { "Red", "Green", "Blue", "Yellow" };
            var      lastPawnPlayed = new Pawn();

            while (allPlaying)
            {
                var color = colors[index];
                gui.Clear();
                gui.ShowBoard(game, previousColor);
                gui.ShowStats(game, color);
                if (gui.CheckFinishedStatus(game))
                {
                    allPlaying = false;
                    Console.Clear();
                    var winner = game.Players.First(p => p.Color == color);
                    Console.WriteLine(winner.Name);
                    Console.ReadLine();
                    context.SaveChanges();
                }
                else
                {
                    Console.WriteLine("Do you want to Exit the game?");
                    List <string> options = new List <string>();
                    options.AddRange(new string[] { "Yes", "No" });

                    var choice = MenuNavigator.Menu.ShowMenu(options);

                    if (choice == "Yes")
                    {
                        Console.WriteLine("Do you want to save the game?");
                        List <string> optionss = new List <string>();
                        optionss.AddRange(new string[] { "Yes", "No" });

                        var choicee = MenuNavigator.Menu.ShowMenu(optionss);
                        if (choicee == "Yes")
                        {
                            context.SaveChanges();
                        }
                        System.Environment.Exit(0);
                    }

                    lastPawnPlayed = gui.RollDiceNextPlayer(context, game, color);
                    index++;
                    if (index > 3)
                    {
                        index = 0;
                    }
                }
                game.Turn    += 1;
                previousColor = color;
            }
        }