Exemple #1
0
        public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers)
        {
            int inventoryLayerIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));

            if (inventoryLayerIndex != -1)
            {
                layers.Insert(inventoryLayerIndex, new LegacyGameInterfaceLayer(
                                  "HerosMod: UI",
                                  delegate
                {
                    try
                    {
                        HEROsMod.Update();

                        HEROsMod.ServiceHotbar.Update();

                        HEROsMod.DrawBehindUI(Main.spriteBatch);

                        HEROsMod.Draw(Main.spriteBatch);

                        KeybindController.DoPreviousKeyState();
                    }
                    catch (Exception e)
                    {
                        ModUtils.DebugText("HerosMod: UI Error: " + e.Message + e.StackTrace);
                    }
                    return(true);
                },
                                  InterfaceScaleType.UI)
                              );

                // Technically before the above GameInterfaceLayer
                layers.Insert(inventoryLayerIndex, new LegacyGameInterfaceLayer(
                                  "HerosMod: UI (Game Scale)",
                                  delegate {
                    try
                    {
                        if (ModUtils.NetworkMode != NetworkMode.Server)
                        {
                            foreach (var service in ServiceController.Services)
                            {
                                service.UpdateGameScale();
                            }
                        }
                        SelectionTool.Update();
                    }
                    catch (Exception e)
                    {
                        ModUtils.DebugText("HerosMod: UI (Game Scale) Error: " + e.Message + e.StackTrace);
                    }
                    return(true);
                },
                                  InterfaceScaleType.Game)
                              );
            }
        }
Exemple #2
0
        public static void Update(/*GameTime gameTime*/)
        {
            if (ModUtils.NetworkMode != NetworkMode.Server)
            {
                ModUtils.PreviousKeyboardState = Main.keyState;
                ModUtils.PreviousMouseState    = ModUtils.MouseState;
                ModUtils.MouseState            = Mouse.GetState();

                ModUtils.SetDeltaTime(/*gameTime*/);
                ModUtils.Update();
                //HEROsModVideo.Services.MobHUD.MobInfo.Update();
                //CheckIfGameEnteredOrLeft();
                //Update all services in the ServiceController
                foreach (var service in ServiceController.Services)
                {
                    service.Update();
                }
                MasterView.UpdateMaster();
                SelectionTool.Update();
                //if (Main.ingameOptionsWindow && (IngameOptions.category == 2 || IngameOptions.category == 3))
                //{
                //	HEROsModMod.UIKit.MasterView.gameScreen.AddChild(new HEROsModMod.UIKit.UIComponents.KeybindWindow());
                //	IngameOptions.Close();
                //}

                // This is the alternate tooltip code.
                //if (!Main.gameMenu)
                //{
                //	ModUtils.ItemTooltip.Update();
                //}

                // Unused 3D code

                //float speed = .03f;
                //if (Main.keyState.IsKeyDown(Keys.Left))
                //{
                //	angle -= speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Right))
                //{
                //	angle += speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Up))
                //{
                //	angle2 -= speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Down))
                //{
                //	angle2 += speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.X))
                //{
                //	zoom += speed;
                //}
                //if (Main.keyState.IsKeyDown(Keys.Z))
                //{
                //	zoom -= speed;

                //}

                //Matrix worldMatrix = Matrix.Identity
                //	* Matrix.CreateTranslation(new Vector3(-Main.screenWidth / 2, -Main.screenHeight / 2, 0f))
                //	* Matrix.CreateRotationX(angle2)
                //	* Matrix.CreateRotationY(angle)
                //	* Matrix.CreateTranslation(new Vector3(Main.screenWidth / 2 / zoom, Main.screenHeight / 2 / zoom, 0f))
                //	* Matrix.CreateScale(zoom);

                //   ModUtils.TextureExtruder.WorldView = worldMatrix;
            }
            HEROsModNetwork.Network.Update();
            //	HEROsModNetwork.CTF.CaptureTheFlag.Update();
        }