public static void GameLeft() { ModUtils.DebugText("Game left"); Login.LoggedIn = false; ServiceController.MyGroupChanged(); }
public override object Call(params object[] args) { int argsLength = args.Length; Array.Resize(ref args, 6); try { string message = args[0] as string; if (message == "AddSimpleButton") { ModUtils.DebugText("Button Adding..."); RegisterButton( args[1] as string, args[2] as Texture2D, args[3] as Action, args[4] as Action <bool>, args[5] as Func <string> ); ModUtils.DebugText("...Button Added"); } else if (message == "AddPermission") { ModUtils.DebugText("Permission Adding..."); // Internal, RegisterPermission( args[1] as string, args[2] as string, args[3] as Action <bool> ); ModUtils.DebugText("...Permission Added"); } else if (message == "HasPermission") { if (/*Main.netMode != Terraria.ID.NetmodeID.Server ||*/ argsLength != 3) // for now, only allow this call on Server (2) --> why?? { return(false); } //int player = Convert.ToInt32(args[1]); // Convert.ToInt32 doesn't throw exception, casting does. Exception is better in this case. //string permission = args[2] as string; return(Network.Players[(int)args[1]].Group?.HasPermission(args[2] as string) ?? false); // Group might be null, so checking permissions on entering world won't work reliably. } else if (message == "HideHotbar") { if (!ServiceHotbar.Collapsed) { ServiceHotbar.collapseArrow_onLeftClick(null, null); if (!ServiceHotbar.Collapsed) // sub hotbars { ServiceHotbar.collapseArrow_onLeftClick(null, null); } } } else { Logger.Error("Call Error: Unknown Message: " + message); } } catch (Exception e) { Logger.Error("Call Error: " + e.StackTrace + e.Message); } return(null); }
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(); }
public static void DrawBorderedRect(SpriteBatch spriteBatch, Color color, Vector2 position, Vector2 size, int borderWidth) { Color fillColor = color * .3f; ModUtils.DrawBorderedRect(spriteBatch, fillColor, color, position, size, borderWidth); }