/// <summary> /// Unserializes the BigDB database world object. /// </summary> /// <param name="worlddata">The world data.</param> /// <param name="width">The width of the world.</param> /// <param name="height">The height of the world.</param> public static void UnserializeFromComplexObject(DatabaseArray worlddata, int width, int height) { Minimap minimap = new Minimap(); minimap.width = width; minimap.height = height; minimap.initialize(); Console.WriteLine("Unserializing complex object..."); foreach (DatabaseObject ct in worlddata) { if (ct.Count == 0) continue; uint blockId = ct.GetUInt("type"); int layer = ct.GetInt("layer"); byte[] xs = ct.GetBytes("x"), ys = ct.GetBytes("y"); for (var b = 0; b < xs.Length; b += 2) { int nx = (xs[b] << 8) | xs[b + 1], ny = (ys[b] << 8) | ys[b + 1]; minimap.drawBlock(layer, nx, ny, blockId); } } // Write them "on top" of backgrounds minimap.rewriteForegroundBlocks(); minimap.Save(worldID + "_bigdb.png"); generating_minimap = false; }
void Start() { map = new Minimap(); form = new CameraForm(new Bitmap(128,128)); window = new Thread(this.startThread); window.Start(); }
void Start() { defaultSprite = GetComponent<Image>().sprite; map = GetComponentInParent<Minimap>(); myRectTransform = GetComponent<RectTransform>(); float scale = Mathf.Max(MinScale, map.ZoomLevel); myRectTransform.localScale = new Vector3(scale, scale, 1); }
public void LoadMinimap(Minimap Minimap) { this.Minimap = Minimap; //load tile textures foreach (MinimapTile tile in Minimap.Tiles) { tile.LoadTexture(GraphicsDevice); } }
public Dungeon(int maxRooms) { RoomList = new List<Room>(); _maxRooms = maxRooms; _currentAmtOfRooms = 0; _currentRoomIndex = 0; Generate(); minimap = new Minimap(this); }
public HudMap(Hud hud, SpriteFont font, Game1 game) : base(hud, font, game) { minimap = new Minimap(game); mapPos = new Vector2(1455, 752); hudMapF = game.Content.Load<Texture2D>(@"Hud/mapF"); mask = game.Content.Load<Texture2D>(@"Hud/mapMask"); hudMapB = game.Content.Load<Texture2D>(@"Hud/mapO"); alphaMap = game.Content.Load<Effect>(@"Effects/AlphaMap"); barMask = game.Content.Load<Texture2D>(@"Hud/Masks/mapBar"); barTarg = new RenderTarget2D(game.GraphicsDevice, 272, 16); rTarg = new RenderTarget2D(game.GraphicsDevice, 402, 283); mapTarg = new RenderTarget2D(game.GraphicsDevice, 402, 283); spB = new SpriteBatch(game.GraphicsDevice); }
void Start() { minimap = GetComponentInChildren<Minimap>(); Debug.Log("Minimap"); minimap.gameObject.SetActive(false); state = playerState.StageStart; //Freeze(); rb = GetComponent<Rigidbody>(); result.SetActive(false); dead.SetActive(false); isAfterClear = false; settingBGM(); //int level = 99; //int stage = 99; //int min = 80; //int sec = 70; //Debug.Log(getLeaderboardRecord(90, 90)); //Debug.Log(getLeaderboardRecord(90, 90)[0] + " " + getLeaderboardRecord(90, 90)[1]); }
public void SetUpBlip(Sprite mapIcon, Color teamColor, GameObject target, Minimap map) { /* if (teamColor == null) { teamColor = new Color(0,0,0,255); }*/ if (!sprite) sprite = GetComponent<Image>(); Map = map; Target = target.transform; ownersID = "ID" + target.name; MapIcon = mapIcon; sprite.sprite = MapIcon; TeamColor = new Color(teamColor.r, teamColor.g, teamColor.b, 1); sprite.color = TeamColor; Unit unit = target.GetComponent<Unit>(); if (unit) { if (unit.unitType == UnitType.Hero) KeepInBounds = true; } SetUp = true; }
/// <summary> /// Unserializes the BigDB database world object. /// </summary> /// <param name="worlddata">The world data.</param> /// <param name="width">The width of the world.</param> /// <param name="height">The height of the world.</param> public static void UnserializeFromComplexObject(DatabaseObject input, int width, int height, string worldID) { Minimap minimap = new Minimap(); minimap.width = width; minimap.height = height; minimap.initialize(); if (input.Contains("worlddata")) { foreach (DatabaseObject ct in input.GetArray("worlddata").Reverse()) { if (ct.Count == 0) continue; uint blockId = ct.GetUInt("type"); int layer = ct.GetInt("layer", 0); byte[] x = ct.GetBytes("x", new byte[0]), y = ct.GetBytes("y", new byte[0]), x1 = ct.GetBytes("x1", new byte[0]), y1 = ct.GetBytes("y1", new byte[0]); for (int j = 0; j < x1.Length; j++) { byte nx = x1[j]; byte ny = y1[j]; minimap.drawBlock(layer, nx, ny, blockId); } for (int k = 0; k < x.Length; k += 2) { uint nx2 = (uint)(((int)x[k] << 8) + (int)x[k + 1]); uint ny2 = (uint)(((int)y[k] << 8) + (int)y[k + 1]); minimap.drawBlock(layer, (int)nx2, (int)ny2, blockId); } } } else if (input.Contains("world")) { } minimap.Save(worldID + "_bigdb.png", histogram); }
void Start() { m_minimap = new Minimap(); //if the user has selected a rendertexture in the inspector to be the target //then use that one, otherwise make a new rendertexture and make it avalible //via the TargetTexture field TargetTexture = m_minimap.Image; //only use the current camera if PlayerCamera was not set in the //inspector if (PlayerCamera == null) { //check to see if we are connected to a camera if (GetComponent<Camera>()) { //and if we are use that camera as the player camera PlayerCamera = GetComponent<Camera>(); } } viewBox = m_minimap.getViewBoxGameObject(PlayerCamera, true, 30.0f); }
void Start() { map=new Minimap(new Rect(Screen.width-220,Screen.height-220,200,200)); }
void Awake() { thisCamera = this.GetComponent <Camera>(); minimap = this.GetComponent <Minimap>(); }
public void update() { if (Settings.MinimapSetting && RCSettings.globalDisableMinimap != 1 && !Minimap.instance.isEnabled) { gameObject.GetComponent <Minimap>().SetEnabled(true); Minimap.TryRecaptureInstance(); } if (flashDuration > 0f) { flashDuration -= Time.deltaTime; if (flashDuration <= 0f) { flashDuration = 0f; } GameObjectCache.Find("flash").GetComponent <UISprite>().alpha = flashDuration * 0.5f; } if (gametype == GAMETYPE.STOP) { Screen.showCursor = true; Screen.lockCursor = false; } else { if (gametype != GAMETYPE.SINGLE && gameOver) { if (inputManager.isInputDown[InputCode.attack1]) { if (spectatorMode) { setSpectorMode(false); } else { setSpectorMode(true); } } if (Input.GetKeyDown(KeyCode.Alpha2)) { currentPeekPlayerIndex++; var length = GameObject.FindGameObjectsWithTag("Player").Length; if (currentPeekPlayerIndex >= length) { currentPeekPlayerIndex = 0; } if (length > 0) { setMainObject(GameObject.FindGameObjectsWithTag("Player")[currentPeekPlayerIndex]); setSpectorMode(false); lockAngle = false; } } if (Input.GetKeyDown(KeyCode.Alpha1)) { currentPeekPlayerIndex--; var num2 = GameObject.FindGameObjectsWithTag("Player").Length; if (currentPeekPlayerIndex >= num2) { currentPeekPlayerIndex = 0; } if (currentPeekPlayerIndex < 0) { currentPeekPlayerIndex = num2; } if (num2 > 0) { setMainObject(GameObject.FindGameObjectsWithTag("Player")[currentPeekPlayerIndex]); setSpectorMode(false); lockAngle = false; } } if (spectatorMode) { return; } } if (inputManager.isInputDown[InputCode.pause]) { if (isPausing) { if (main_object != null) { var position = transform.position; position = head == null ? main_object.transform.position : head.transform.position; position += Vector3.up * heightMulti; transform.position = Vector3.Lerp(transform.position, position - transform.forward * 5f, 0.2f); } return; } isPausing = !isPausing; if (isPausing) { if (gametype == GAMETYPE.SINGLE) { Time.timeScale = 0f; } GameObjectCache.Find("InputManagerController").GetComponent <FengCustomInputs>().menuOn = true; Page.GetInstance <PauseMenu>().Enable(); Screen.showCursor = true; Screen.lockCursor = false; } } if (needSetHUD) { needSetHUD = false; setHUDposition(); Screen.lockCursor = !Screen.lockCursor; Screen.lockCursor = !Screen.lockCursor; } if (inputManager.isInputDown[InputCode.fullscreen]) { Screen.fullScreen = !Screen.fullScreen; if (Screen.fullScreen) { Screen.SetResolution(960, 600, false); } else { Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true); } needSetHUD = true; Minimap.OnScreenResolutionChanged(); } if (inputManager.isInputDown[InputCode.restart]) { reset(); } if (main_object != null) { RaycastHit hit; if (inputManager.isInputDown[InputCode.camera]) { switch (cameraMode) { case CAMERA_TYPE.ORIGINAL: if (Settings.CameraTypeSettings[2]) { cameraMode = CAMERA_TYPE.WOW; Screen.lockCursor = false; } else if (Settings.CameraTypeSettings[1]) { cameraMode = CAMERA_TYPE.TPS; Screen.lockCursor = true; } else if (Settings.CameraTypeSettings[3]) { cameraMode = CAMERA_TYPE.OLDTPS; Screen.lockCursor = true; } break; case CAMERA_TYPE.WOW: if (Settings.CameraTypeSettings[1]) { cameraMode = CAMERA_TYPE.TPS; Screen.lockCursor = true; } else if (Settings.CameraTypeSettings[3]) { cameraMode = CAMERA_TYPE.OLDTPS; Screen.lockCursor = true; } else if (Settings.CameraTypeSettings[0]) { cameraMode = CAMERA_TYPE.ORIGINAL; Screen.lockCursor = false; } break; case CAMERA_TYPE.TPS: if (Settings.CameraTypeSettings[3]) { cameraMode = CAMERA_TYPE.OLDTPS; Screen.lockCursor = true; } else if (Settings.CameraTypeSettings[0]) { cameraMode = CAMERA_TYPE.ORIGINAL; Screen.lockCursor = false; } else if (Settings.CameraTypeSettings[2]) { cameraMode = CAMERA_TYPE.WOW; Screen.lockCursor = false; } break; case CAMERA_TYPE.OLDTPS: if (Settings.CameraTypeSettings[0]) { cameraMode = CAMERA_TYPE.ORIGINAL; Screen.lockCursor = false; } else if (Settings.CameraTypeSettings[2]) { cameraMode = CAMERA_TYPE.WOW; Screen.lockCursor = false; } else if (Settings.CameraTypeSettings[1]) { cameraMode = CAMERA_TYPE.TPS; Screen.lockCursor = true; } break; } if ((int)FengGameManagerMKII.settings[245] == 1 || main_object.GetComponent <HERO>() == null) { Screen.showCursor = false; } } if (inputManager.isInputDown[InputCode.hideCursor]) { Screen.showCursor = !Screen.showCursor; } if (inputManager.isInputDown[InputCode.focus]) { triggerAutoLock = !triggerAutoLock; if (triggerAutoLock) { lockTarget = findNearestTitan(); if (closestDistance >= 150f) { lockTarget = null; triggerAutoLock = false; } } } if (gameOver && main_object != null) { if (FengGameManagerMKII.inputRC.isInputHumanDown(InputCodeRC.liveCam)) { if ((int)FengGameManagerMKII.settings[263] == 0) { FengGameManagerMKII.settings[263] = 1; } else { FengGameManagerMKII.settings[263] = 0; } } var component = main_object.GetComponent <HERO>(); if (component != null && (int)FengGameManagerMKII.settings[263] == 1 && component.GetComponent <SmoothSyncMovement>().enabled&& component.isPhotonCamera) { CameraMovementLive(component); } else if (lockAngle) { transform.rotation = Quaternion.Lerp(transform.rotation, main_object.transform.rotation, 0.2f); transform.position = Vector3.Lerp(transform.position, main_object.transform.position - main_object.transform.forward * 5f, 0.2f); } else { camareMovement(); } } else { camareMovement(); } if (triggerAutoLock && lockTarget != null) { var z = this.transform.eulerAngles.z; var transform = lockTarget.transform.Find("Amarture/Core/Controller_Body/hip/spine/chest/neck"); var vector2 = transform.position - (head == null ? main_object.transform.position : head.transform.position); vector2.Normalize(); lockCameraPosition = head == null ? main_object.transform.position : head.transform.position; lockCameraPosition -= vector2 * distance * distanceMulti * distanceOffsetMulti; lockCameraPosition += Vector3.up * 3f * heightMulti * distanceOffsetMulti; this.transform.position = Vector3.Lerp(this.transform.position, lockCameraPosition, Time.deltaTime * 4f); if (head != null) { this.transform.LookAt(head.transform.position * 0.8f + transform.position * 0.2f); } else { this.transform.LookAt(main_object.transform.position * 0.8f + transform.position * 0.2f); } this.transform.localEulerAngles = new Vector3(this.transform.eulerAngles.x, this.transform.eulerAngles.y, z); Vector2 vector3 = camera.WorldToScreenPoint(transform.position - transform.forward * lockTarget.transform.localScale.x); locker.transform.localPosition = new Vector3(vector3.x - Screen.width * 0.5f, vector3.y - Screen.height * 0.5f, 0f); if (lockTarget.GetComponent <TITAN>() != null && lockTarget.GetComponent <TITAN>().hasDie) { lockTarget = null; } } else { locker.transform.localPosition = new Vector3(0f, -Screen.height * 0.5f - 50f, 0f); } var end = head == null ? main_object.transform.position : head.transform.position; var vector5 = (head == null ? main_object.transform.position : head.transform.position) - this.transform.position; var normalized = vector5.normalized; end -= distance * normalized * distanceMulti; LayerMask mask = 1 << LayerMask.NameToLayer("Ground"); LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox"); LayerMask mask3 = mask | mask2; if (head != null) { if (Physics.Linecast(head.transform.position, end, out hit, mask)) { transform.position = hit.point; } else if (Physics.Linecast(head.transform.position - normalized * distanceMulti * 3f, end, out hit, mask2)) { transform.position = hit.point; } Debug.DrawLine(head.transform.position - normalized * distanceMulti * 3f, end, Color.red); } else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hit, mask3)) { transform.position = hit.point; } shakeUpdate(); } } }
public override void Clicked() { Box tmpBox, tmpBox2; Alignment tmpAlign; Box vbox = new Gtk.VBox(); vbox.Spacing = 3; Box hbox = new Gtk.HBox(); hbox.Spacing = 3; Box dungeonVreContainer = new Gtk.VBox(); Box roomVreContainer = new Gtk.VBox(); ValueReferenceEditor dungeonVre = null; ValueReferenceEditor roomVre = null; Alignment frame = new Alignment(0, 0, 0, 0); var dungeonSpinButton = new SpinButton(0, 15, 1); var floorSpinButton = new SpinButton(0, 15, 1); var roomSpinButton = new SpinButtonHexadecimal(0, 255, 1); roomSpinButton.Digits = 2; Minimap minimap = null; System.Action RoomChanged = () => { Dungeon dungeon = minimap.Map as Dungeon; Room room = minimap.GetRoom(); roomSpinButton.Value = room.Index & 0xff; var vrs = new List <ValueReference>(); vrs.Add(new StreamValueReference("Up", room.Index & 0xff, 0, 0, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Right", room.Index & 0xff, 1, 1, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Down", room.Index & 0xff, 2, 2, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Left", room.Index & 0xff, 3, 3, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Key", room.Index & 0xff, 4, 4, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Chest", room.Index & 0xff, 5, 5, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Boss", room.Index & 0xff, 6, 6, DataValueType.ByteBit)); vrs.Add(new StreamValueReference("Dark", room.Index & 0xff, 7, 7, DataValueType.ByteBit)); Stream stream = Project.GetBinaryFile("rooms/" + Project.GameString + "/group" + dungeon.Group + "DungeonProperties.bin"); foreach (StreamValueReference r in vrs) { r.SetStream(stream); } if (roomVre != null) { roomVreContainer.Remove(roomVre); } var vrg = new ValueReferenceGroup(vrs); roomVre = new ValueReferenceEditor(Project, vrg, 4, "Minimap Data"); roomVreContainer.Add(roomVre); }; System.Action DungeonChanged = () => { Dungeon dungeon = Project.GetIndexedDataType <Dungeon>(dungeonSpinButton.ValueAsInt); floorSpinButton.Adjustment.Upper = dungeon.NumFloors - 1; if (floorSpinButton.ValueAsInt >= dungeon.NumFloors) { floorSpinButton.Value = dungeon.NumFloors - 1; } var vrs = new List <ValueReference>(); vrs.Add(new ValueReference("Group", 0, DataValueType.String, false)); vrs.Add(new ValueReference("Wallmaster dest room", 0, DataValueType.Byte)); vrs.Add(new ValueReference("Bottom floor layout", 0, DataValueType.Byte, false)); vrs.Add(new ValueReference("# of floors", 0, DataValueType.Byte, false)); vrs.Add(new ValueReference("Base floor name", 0, DataValueType.Byte)); vrs.Add(new ValueReference("Floors unlocked with compass", 0, DataValueType.Byte)); Data data = dungeon.DataStart; foreach (ValueReference r in vrs) { r.SetData(data); data = data.NextData; } // Remove last ValueReferenceEditor if (dungeonVre != null) { dungeonVreContainer.Remove(dungeonVre); } var vrg = new ValueReferenceGroup(vrs); dungeonVre = new ValueReferenceEditor(Project, vrg, "Base Data"); dungeonVre.AddDataModifiedHandler(() => { floorSpinButton.Adjustment.Upper = dungeon.NumFloors; minimap.GenerateImage(); RoomChanged(); }); // Replace the "group" option with a custom widget for finer // control. SpinButton groupSpinButton = new SpinButton(4, 5, 1); groupSpinButton.Value = dungeon.Group; groupSpinButton.ValueChanged += (c, d) => { vrg.SetValue("Group", ">wGroup" + groupSpinButton.ValueAsInt + "Flags"); }; dungeonVre.ReplaceWidget(0, groupSpinButton); dungeonVre.ShowAll(); // Tooltips dungeonVre.SetTooltip(0, "Also known as the high byte of the room index."); dungeonVre.SetTooltip(1, "The low byte of the room index wallmasters will send you to."); dungeonVre.SetTooltip(2, "The index of the layout for the bottom floor. Subsequent floors will use subsequent indices."); dungeonVre.SetTooltip(4, "Determines what the game will call the bottom floor. For a value of:\n$00: The bottom floor is 'B3'.\n$01: The bottom floor is 'B2'.\n$02: The bottom floor is 'B1'.\n$03: The bottom floor is 'F1'."); dungeonVre.SetTooltip(5, "A bitset of floors that will appear on the map when the compass is obtained.\n\nEg. If this is $05, then floors 0 and 2 will be unlocked (bits 0 and 2 are set)."); dungeonVreContainer.Add(dungeonVre); minimap.SetMap(dungeon); minimap.Floor = floorSpinButton.ValueAsInt; RoomChanged(); }; dungeonSpinButton.ValueChanged += (a, b) => { DungeonChanged(); }; floorSpinButton.ValueChanged += (a, b) => { DungeonChanged(); }; frame.Add(vbox); tmpBox = new Gtk.HBox(); tmpBox.Add(new Gtk.Label("Dungeon ")); tmpBox.Add(dungeonSpinButton); tmpBox.Add(new Gtk.Label("Floor ")); tmpBox.Add(floorSpinButton); tmpAlign = new Alignment(0, 0, 0, 0); tmpAlign.Add(tmpBox); vbox.Add(tmpAlign); vbox.Add(hbox); // Leftmost column tmpBox = new VBox(); tmpBox.Add(dungeonVreContainer); var addFloorButton = new Button("Add Floor"); addFloorButton.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button); addFloorButton.Clicked += (a, b) => { Dungeon dungeon = minimap.Map as Dungeon; int newFloorIndex = dungeon.FirstLayoutIndex + dungeon.NumFloors; // Shift all subsequent layouts 64 bytes down in the data file Stream layoutFile = Project.GetBinaryFile("rooms/" + Project.GameString + "/dungeonLayouts.bin"); layoutFile.SetLength(layoutFile.Length + 64); for (int i = (int)layoutFile.Length / 64 - 1; i > newFloorIndex; i--) { var buf = new byte[64]; layoutFile.Position = (i - 1) * 64; layoutFile.Read(buf, 0, 64); layoutFile.Write(buf, 0, 64); } // Clear the new floor layoutFile.Position = newFloorIndex * 64; for (int j = 0; j < 64; j++) { layoutFile.WriteByte(0); } // Shift each dungeon's "FirstLayoutIndex" to match the shifted layouts. for (int i = 0; i < Project.GetNumDungeons(); i++) { Dungeon d2 = Project.GetIndexedDataType <Dungeon>(i); if (d2.FirstLayoutIndex >= newFloorIndex) { d2.FirstLayoutIndex++; } } dungeon.NumFloors = dungeon.NumFloors + 1; floorSpinButton.Value = dungeon.NumFloors - 1; DungeonChanged(); }; tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0); tmpAlign.Add(addFloorButton); tmpBox.Add(tmpAlign); var removeFloorButton = new Button("Remove Top Floor"); removeFloorButton.Image = new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Button); removeFloorButton.Clicked += (a, b) => { Dungeon dungeon = minimap.Map as Dungeon; if (dungeon.NumFloors <= 1) { return; } Gtk.MessageDialog d = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.YesNo, "Are you quite certain that you wish to delete the top floor of this dungeon?"); var response = (ResponseType)d.Run(); d.Destroy(); if (response == Gtk.ResponseType.Yes) { int deletedFloorIndex = dungeon.FirstLayoutIndex + dungeon.NumFloors - 1; // Shift all subsequent layouts 64 bytes up in the data file Stream layoutFile = Project.GetBinaryFile("rooms/" + Project.GameString + "/dungeonLayouts.bin"); for (int i = deletedFloorIndex; i < layoutFile.Length / 64 - 1; i++) { var buf = new byte[64]; layoutFile.Position = (i + 1) * 64; layoutFile.Read(buf, 0, 64); layoutFile.Position = i * 64; layoutFile.Write(buf, 0, 64); } layoutFile.SetLength(layoutFile.Length - 64); // Shift each dungeon's "FirstLayoutIndex" to match the shifted layouts. for (int i = 0; i < Project.GetNumDungeons(); i++) { Dungeon d2 = Project.GetIndexedDataType <Dungeon>(i); if (d2.FirstLayoutIndex > deletedFloorIndex) { d2.FirstLayoutIndex--; } } dungeon.NumFloors = dungeon.NumFloors - 1; DungeonChanged(); } }; tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0); tmpAlign.Add(removeFloorButton); tmpBox.Add(tmpAlign); hbox.Add(tmpBox); // Middle column (minimap) minimap = new Minimap(); minimap.TileSelectedEvent += (sender) => { RoomChanged(); }; hbox.Add(minimap); // Rightmost column tmpAlign = new Alignment(0, 0, 0, 0); tmpAlign.Add(roomVreContainer); tmpBox2 = new HBox(); tmpBox2.Add(new Gtk.Label("Room ")); roomSpinButton.ValueChanged += (a, b) => { (minimap.Map as Dungeon).SetRoom(minimap.SelectedX, minimap.SelectedY, minimap.Floor, roomSpinButton.ValueAsInt); minimap.GenerateImage(); RoomChanged(); }; tmpBox2.Add(roomSpinButton); tmpBox = new VBox(); tmpBox.Add(tmpBox2); tmpBox.Add(tmpAlign); hbox.Add(tmpBox); Window w = new Window(null); w.Add(frame); w.ShowAll(); Map map = manager.GetActiveMap(); if (map is Dungeon) { dungeonSpinButton.Value = map.Index; } DungeonChanged(); }
/// <summary> /// Initializes static members of the <see cref="HUDInfo" /> class. /// </summary> static HUDInfo() { double tinfoHeroDown; double panelHeroSizeX; float compareWidth; ScreenSize = new Vector2(Drawing.Width, Drawing.Height); if (ScreenSize.X == 0) { Console.WriteLine("Ensage couldnt determine your resolution, try to launch in window mode"); return; } currentMinimap = minimaps.FirstOrDefault( x => Math.Abs(x.Key.X - ScreenSize.X) < 10 && Math.Abs(x.Key.Y - ScreenSize.Y) < 10).Value; if (currentMinimap == null) { Console.WriteLine("Could not find minimap data for your resolution"); } else { minimapMapScaleX = currentMinimap.Size.X / mapWidth; minimapMapScaleY = currentMinimap.Size.Y / mapHeight; } var ratio = Math.Floor((decimal)(ScreenSize.X / ScreenSize.Y * 100)); if (ratio == 213) { compareWidth = 1600; panelHeroSizeX = 45.28; tinfoHeroDown = 25.714; DireCompare = 2.402; RadiantCompare = 3.08; HpBarHeight = 7; HpBarWidth = 69; HpBarX = 36; HpBarY = 23; } else if (ratio == 177) { compareWidth = 1600; panelHeroSizeX = 55.09; tinfoHeroDown = 25.714; DireCompare = 2.5401; RadiantCompare = 3.499; HpBarHeight = 10; HpBarWidth = 84; HpBarX = 43; HpBarY = 27; } else if (ratio == 166) { compareWidth = 1280; panelHeroSizeX = 47.19; tinfoHeroDown = 25.714; DireCompare = 2.59; RadiantCompare = 3.64; HpBarHeight = 7.4; HpBarWidth = 71; HpBarX = 37; HpBarY = 22; } else if (ratio == 160) { compareWidth = 1280; panelHeroSizeX = 48.95; tinfoHeroDown = 25.714; DireCompare = 2.609; RadiantCompare = 3.78; HpBarHeight = 9; HpBarWidth = 75; HpBarX = 38.3; HpBarY = 25; } else if (ratio == 150) { compareWidth = 1280; panelHeroSizeX = 51.39; tinfoHeroDown = 25.714; DireCompare = 2.64; RadiantCompare = 4.02; HpBarHeight = 8; HpBarWidth = 79.2; HpBarX = 40.2; HpBarY = 24; } else if (ratio == 133) { compareWidth = 1024; panelHeroSizeX = 47.21; tinfoHeroDown = 25.714; DireCompare = 2.775; RadiantCompare = 4.57; HpBarHeight = 8; HpBarWidth = 71; HpBarX = 36.6; HpBarY = 23; } else if (ratio == 125) { compareWidth = 1280; panelHeroSizeX = 58.3; tinfoHeroDown = 25.714; DireCompare = 2.78; RadiantCompare = 4.65; HpBarHeight = 11; HpBarWidth = 96.5; HpBarX = 49; HpBarY = 32; } else { Console.WriteLine( @"Your screen resolution is not supported and drawings might have wrong size/position, (" + ratio + ")"); compareWidth = 1600; panelHeroSizeX = 65; tinfoHeroDown = 25.714; DireCompare = 2.655; RadiantCompare = 5.985; HpBarHeight = 10; HpBarWidth = 83.5; HpBarX = 43; HpBarY = 28; } Monitor = ScreenSize.X / compareWidth; Rate = Math.Max(Monitor, 1); X = panelHeroSizeX * Monitor; y = ScreenSize.Y / tinfoHeroDown; //Drawing.OnDraw += Drawing_OnDraw; //var mipos = new Vector3(MapLeft, MapTop, 0).WorldToMinimap(); //var minimap = new Render.Rectangle( // mipos.X, // mipos.Y, // currentMinimap.Size.X, // currentMinimap.Size.Y, // new ColorBGRA(100, 100, 100, 50)); //minimap.Add(); }
void SetupMiniMap(Transform player) { if (!miniMap) miniMap = GetComponentInChildren<Minimap>(); miniMap.Target = player; addBlip(player, true, false, false, "Images/Minimap/" + GetPlayerRole(ps), "me", 1.3f); InvokeRepeating("AddAllPickups", 1, 10); InvokeRepeating("AddAllPlayers", 1, 10); }
void Start() { HarvestedResources = new Units.Resources(); if (playerView == null) { playerView = GetComponent<Camera>(); } minimap = new Minimap(); TownCenter center = new TownCenter(); center.CreateFreeUnit(this, startPos, Quaternion.identity); m_selectionManager = new SelectionManager(this); }
/// <summary> /// Creates all of the sub-components of the GUI in for the PlayState (buttons, etc.) /// </summary> public void CreateGUIComponents() { GUI.RootComponent.ClearChildren(); GridLayout layout = new GridLayout(GUI, GUI.RootComponent, 11, 11) { LocalBounds = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), WidthSizeMode = GUIComponent.SizeMode.Fixed, HeightSizeMode = GUIComponent.SizeMode.Fixed }; GUI.RootComponent.AddChild(Master.Debugger.MainPanel); layout.AddChild(Master.ToolBar); Master.ToolBar.Parent = layout; layout.SetComponentPosition(Master.ToolBar, 7, 10, 4, 1); GUIComponent companyInfoComponent = new GUIComponent(GUI, layout); layout.SetComponentPosition(companyInfoComponent, 0, 0, 4, 2); GUIComponent resourceInfoComponent = new ResourceInfoComponent(GUI, layout, Master.Faction); layout.SetComponentPosition(resourceInfoComponent, 7, 0, 2, 2); GridLayout infoLayout = new GridLayout(GUI, companyInfoComponent, 3, 4); CompanyLogoPanel = new ImagePanel(GUI, infoLayout, PlayerCompany.Logo); infoLayout.SetComponentPosition(CompanyLogoPanel, 0, 0, 1, 1); CompanyNameLabel = new Label(GUI, infoLayout, PlayerCompany.Name, GUI.DefaultFont) { TextColor = Color.White, StrokeColor = new Color(0, 0, 0, 255), ToolTip = "Our company Name.", Alignment = Drawer2D.Alignment.Top, }; infoLayout.SetComponentPosition(CompanyNameLabel, 1, 0, 1, 1); MoneyLabel = new DynamicLabel(GUI, infoLayout, "Money:\n", "", GUI.DefaultFont, "C2", () => Master.Faction.Economy.CurrentMoney) { TextColor = Color.White, StrokeColor = new Color(0, 0, 0, 255), ToolTip = "Amount of money in our treasury.", Alignment = Drawer2D.Alignment.Top, }; infoLayout.SetComponentPosition(MoneyLabel, 3, 0, 1, 1); StockLabel = new DynamicLabel(GUI, infoLayout, "Stock:\n", "", GUI.DefaultFont, "C2", () => Master.Faction.Economy.Company.StockPrice) { TextColor = Color.White, StrokeColor = new Color(0, 0, 0, 255), ToolTip = "The price of our company stock.", Alignment = Drawer2D.Alignment.Top, }; infoLayout.SetComponentPosition(StockLabel, 5, 0, 1, 1); TimeLabel = new Label(GUI, layout, Time.CurrentDate.ToShortDateString() + " " + Time.CurrentDate.ToShortTimeString(), GUI.SmallFont) { TextColor = Color.White, StrokeColor = new Color(0, 0, 0, 255), Alignment = Drawer2D.Alignment.Top, ToolTip = "Current time and date." }; layout.SetComponentPosition(TimeLabel, 6, 0, 1, 1); CurrentLevelLabel = new Label(GUI, infoLayout, "Slice: " + ChunkManager.ChunkData.MaxViewingLevel, GUI.DefaultFont) { TextColor = Color.White, StrokeColor = new Color(0, 0, 0, 255), ToolTip = "The maximum height of visible terrain" }; infoLayout.SetComponentPosition(CurrentLevelLabel, 0, 1, 1, 1); CurrentLevelUpButton = new Button(GUI, infoLayout, "", GUI.DefaultFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowUp)) { ToolTip = "Go up one level of visible terrain", KeepAspectRatio = true, DontMakeBigger = true, DontMakeSmaller = true }; infoLayout.SetComponentPosition(CurrentLevelUpButton, 1, 1, 1, 1); CurrentLevelUpButton.OnClicked += CurrentLevelUpButton_OnClicked; CurrentLevelDownButton = new Button(GUI, infoLayout, "", GUI.DefaultFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowDown)) { ToolTip = "Go down one level of visible terrain", KeepAspectRatio = true, DontMakeBigger = true, DontMakeSmaller = true }; infoLayout.SetComponentPosition(CurrentLevelDownButton, 1, 2, 1, 1); CurrentLevelDownButton.OnClicked += CurrentLevelDownButton_OnClicked; /* LevelSlider = new Slider(GUI, layout, "", ChunkManager.ChunkData.MaxViewingLevel, 0, ChunkManager.ChunkData.ChunkSizeY, Slider.SliderMode.Integer) { Orient = Slider.Orientation.Vertical, ToolTip = "Controls the maximum height of visible terrain", DrawLabel = false }; layout.SetComponentPosition(LevelSlider, 0, 1, 1, 6); LevelSlider.OnClicked += LevelSlider_OnClicked; LevelSlider.InvertValue = true; */ MiniMap = new Minimap(GUI, layout, 192, 192, this, TextureManager.GetTexture(ContentPaths.Terrain.terrain_colormap), TextureManager.GetTexture(ContentPaths.GUI.gui_minimap)) { IsVisible = true }; layout.SetComponentPosition(MiniMap, 0, 8, 4, 4); Rectangle rect = layout.GetRect(new Rectangle(0, 8, 4, 4)); layout.SetComponentOffset(MiniMap, new Point(0, rect.Height - 250)); Button moneyButton = new Button(GUI, layout, "Economy", GUI.SmallFont, Button.ButtonMode.ImageButton, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 2, 1)) { KeepAspectRatio = true, ToolTip = "Opens the Economy Menu", DontMakeBigger = true, DrawFrame = true, TextColor = Color.White }; moneyButton.OnClicked += moneyButton_OnClicked; Button settingsButton = new Button(GUI, layout, "Settings", GUI.SmallFont, Button.ButtonMode.ImageButton, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 4, 1)) { KeepAspectRatio = true, ToolTip = "Opens the Settings Menu", DontMakeBigger = true, DrawFrame = true, TextColor = Color.White }; settingsButton.OnClicked += OpenPauseMenu; layout.SetComponentPosition(settingsButton, 10, 0, 1, 1); layout.SetComponentPosition(moneyButton, 9, 0, 1, 1); InputManager.KeyReleasedCallback -= InputManager_KeyReleasedCallback; InputManager.KeyReleasedCallback += InputManager_KeyReleasedCallback; AnnouncementViewer = new AnnouncementViewer(GUI, layout, AnnouncementManager); layout.SetComponentPosition(AnnouncementViewer, 3, 10, 3, 1); layout.UpdateSizes(); }
public static bool IgnoreKeyPresses(bool extra = false) { return(ZNetScene.instance == null || Player.m_localPlayer == null || Minimap.IsOpen() || Console.IsVisible() || TextInput.IsVisible() || ZNet.instance.InPasswordDialog() || Chat.instance?.HasFocus() == true || StoreGui.IsVisible() || InventoryGui.IsVisible() || Menu.IsVisible() || TextViewer.instance?.IsVisible() == true); }
/// <summary> /// Handles all incoming PlayerIO messages /// </summary> /// <param name="sender">The sender.</param> /// <param name="m">The message.</param> static void Connection_OnMessage(object sender, Message m) { if (m.Type != "init") return; Console.WriteLine("Inited"); globalConn.Disconnect(); Minimap minimap = new Minimap(); minimap.width = m.GetInt(15); minimap.height = m.GetInt(16); minimap.initialize(); Console.WriteLine("Parsing init data..."); uint p = 22; while (m[p] as string != "ws") p++; p++; // Parse world data while (p < m.Count) { uint blockId = m.GetUInt(p); int layer = m.GetInt(p + 1); byte[] xs = m.GetByteArray(p + 2), ys = m.GetByteArray(p + 3); for (var b = 0; b < xs.Length; b += 2) { int nx = (xs[b] << 8) | xs[b + 1], ny = (ys[b] << 8) | ys[b + 1]; minimap.drawBlock(layer, nx, ny, blockId); } p += 4; if (m[p] as string == "we") break; while (p + 3 < m.Count) { if (m[p + 2] is byte[]) break; p++; } } minimap.rewriteForegroundBlocks(); minimap.Save(worldID + ".png"); generating_minimap = false; }
public override void Update(GameTime gameTime) { base.Update(gameTime); foreach (int camIndex in _world.Cameras.Keys) { UpdateCameraBorderBounds(camIndex, _world.Cameras[camIndex].GetMiniMapViewport(Utils.CastRectangleF(Minimap.GetAbsoluteBounds()))); } }
public static void Postfix(Minimap __instance) { //Skip this entirely if disabled in the config. if (showMinimapIcons.Value) { //Populate the list of current HUD characters. List <Character> guysList = new List <Character>(); foreach (EnemyHud.HudData hud in EnemyHud.instance.m_huds.Values) { if (hud.m_character != null && hud.m_hoverTimer < EnemyHud.instance.m_hoverShowDuration) { guysList.Add(hud.m_character); } } //Add minimap pins if they haven't been added already. foreach (Character character in guysList) { if (character is Player) { continue; } bool flag = false; foreach (Minimap.PinData pin in __instance.m_pins) { if (pin.m_name.Equals("CS__" + character.GetZDOID().ToString())) { flag = true; break; } } if (!flag) { __instance.AddPin(character.GetCenterPoint(), Minimap.PinType.RandomEvent, "CS__" + character.GetZDOID().ToString(), false, false); } } //Remove minimap pins which are not needed anymore. List <Minimap.PinData> removePins = new List <Minimap.PinData>(); foreach (Minimap.PinData pin in __instance.m_pins) { if (pin.m_type == Minimap.PinType.RandomEvent && pin.m_name.Contains("CS__")) { bool flag = false; foreach (Character character in guysList) { if (pin.m_name.Equals("CS__" + character.GetZDOID().ToString())) { pin.m_pos.x = character.GetCenterPoint().x; pin.m_pos.y = character.GetCenterPoint().y; pin.m_pos.z = character.GetCenterPoint().z; flag = true; break; } } if (!flag) { removePins.Add(pin); } } } foreach (Minimap.PinData pin in removePins) { __instance.RemovePin(pin); Debug.Log("removing pin for " + pin.m_name); } } }
private void Awake() { instance = this; }
void Awake() { playerMgr = GameObject.FindObjectOfType<PlayerManager>(); minimap = GameObject.FindObjectOfType<Minimap>(); }
public void update2() { if (flashDuration > 0f) { flashDuration -= UnityEngine.Time.deltaTime; if (flashDuration <= 0f) { flashDuration = 0f; } GameObject.Find("flash").GetComponent <UISprite>().alpha = flashDuration * 0.5f; } if (Gametype == GameType.Stop) { Screen.showCursor = true; Screen.lockCursor = false; return; } if (Gametype != GameType.Singleplayer && gameOver) { if (inputManager.isInputDown[InputCode.Attack1]) { if (spectatorMode) { SetSpectorMode(val: false); } else { SetSpectorMode(val: true); } } if (inputManager.isInputDown[InputCode.Flare1]) { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); currentPeekPlayerIndex = (currentPeekPlayerIndex + 1) % players.Length; if (players.Length > 0) { SetMainObject(players[currentPeekPlayerIndex]); SetSpectorMode(val: false); lockAngle = false; } } if (inputManager.isInputDown[InputCode.Flare2]) { currentPeekPlayerIndex--; GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); int num2 = players.Length; if (currentPeekPlayerIndex >= num2) { currentPeekPlayerIndex = 0; } if (currentPeekPlayerIndex < 0) { currentPeekPlayerIndex = num2 - 1; } if (num2 > 0) { SetMainObject(players[currentPeekPlayerIndex]); SetSpectorMode(val: false); lockAngle = false; } } if (spectatorMode) { return; } } if (inputManager.isInputDown[InputCode.Pause]) { if (IsPausing) { if (main_object != null) { Vector3 position = base.transform.position; position = ((head == null) ? main_object.transform.position : head.transform.position); position += Vector3.up * heightMulti; base.transform.position = Vector3.Lerp(base.transform.position, position - base.transform.forward * 5f, 0.2f); } return; } IsPausing = !IsPausing; if (IsPausing) { if (Gametype == GameType.Singleplayer) { UnityEngine.Time.timeScale = 0f; } GameObject.Find("InputManagerController").GetComponent <FengCustomInputs>().menuOn = true; Screen.showCursor = true; Screen.lockCursor = false; } } if (needSetHUD) { needSetHUD = false; SetHUDPosition(); Screen.lockCursor = !Screen.lockCursor; Screen.lockCursor = !Screen.lockCursor; } if (inputManager.isInputDown[InputCode.Fullscreen]) { Screen.fullScreen = !Screen.fullScreen; if (Screen.fullScreen) { Screen.SetResolution(960, 600, fullscreen: false); } else { Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, fullscreen: true); } needSetHUD = true; Minimap.OnScreenResolutionChanged(); } if (inputManager.isInputDown[InputCode.Restart]) { Reset(); } if (main_object == null) { return; } if (inputManager.isInputDown[InputCode.ChangeCamera]) { switch (CameraMode) { case CAMERA_TYPE.TPS: CameraMode = CAMERA_TYPE.ORIGINAL; Screen.lockCursor = false; break; case CAMERA_TYPE.ORIGINAL: CameraMode = CAMERA_TYPE.WOW; Screen.lockCursor = false; break; case CAMERA_TYPE.WOW: CameraMode = CAMERA_TYPE.TPS; Screen.lockCursor = true; break; } if ((int)FengGameManagerMKII.Settings[245] == 1 || main_object.GetComponent <HERO>() == null) { Screen.showCursor = false; } } if (inputManager.isInputDown[InputCode.ToggleCursor]) { Screen.showCursor = !Screen.showCursor; } if (inputManager.isInputDown[InputCode.Focus]) { TriggerAutoLock = !TriggerAutoLock; if (TriggerAutoLock) { lockTarget = FindNearestTitan(); if (closestDistance >= 150f) { lockTarget = null; TriggerAutoLock = false; } } } if (gameOver) { if (FengGameManagerMKII.InputRC.isInputHumanDown(InputCodeRC.LiveCamera)) { if ((int)FengGameManagerMKII.Settings[263] == 0) { FengGameManagerMKII.Settings[263] = 1; } else { FengGameManagerMKII.Settings[263] = 0; } } HERO component = main_object.GetComponent <HERO>(); if (component != null && (int)FengGameManagerMKII.Settings[263] == 1 && component.GetComponent <SmoothSyncMovement>().enabled&& component.isPhotonCamera) { CameraMovementLive(component); } else if (lockAngle) { base.transform.rotation = Quaternion.Lerp(base.transform.rotation, main_object.transform.rotation, 0.2f); base.transform.position = Vector3.Lerp(base.transform.position, main_object.transform.position - main_object.transform.forward * 5f, 0.2f); } else { MoveCamera(); } } else { MoveCamera(); } if (TriggerAutoLock && lockTarget != null) { float z = base.transform.eulerAngles.z; Transform transform = lockTarget.transform.Find("Amarture/Core/Controller_Body/hip/spine/chest/neck"); Vector3 a = transform.position - ((head == null) ? main_object.transform.position : head.transform.position); a.Normalize(); lockCameraPosition = ((head == null) ? main_object.transform.position : head.transform.position); lockCameraPosition -= a * distance * distanceMulti * distanceOffsetMulti; lockCameraPosition += Vector3.up * 3f * heightMulti * distanceOffsetMulti; base.transform.position = Vector3.Lerp(base.transform.position, lockCameraPosition, UnityEngine.Time.deltaTime * 4f); if (head != null) { base.transform.LookAt(head.transform.position * 0.8f + transform.position * 0.2f); } else { base.transform.LookAt(main_object.transform.position * 0.8f + transform.position * 0.2f); } base.transform.localEulerAngles = new Vector3(base.transform.eulerAngles.x, base.transform.eulerAngles.y, z); Vector2 vector = base.camera.WorldToScreenPoint(transform.position - transform.forward * lockTarget.transform.localScale.x); locker.transform.localPosition = new Vector3(vector.x - (float)Screen.width * 0.5f, vector.y - (float)Screen.height * 0.5f, 0f); if (lockTarget.GetComponent <TITAN>() != null && lockTarget.GetComponent <TITAN>().hasDie) { lockTarget = null; } } else { locker.transform.localPosition = new Vector3(0f, (float)(-Screen.height) * 0.5f - 50f, 0f); } Vector3 end = (head == null) ? main_object.transform.position : head.transform.position; Vector3 normalized = (((head == null) ? main_object.transform.position : head.transform.position) - base.transform.position).normalized; end -= distance * normalized * distanceMulti; LayerMask mask = 1 << LayerMask.NameToLayer("Ground"); LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox"); LayerMask mask3 = (int)mask | (int)mask2; RaycastHit hitInfo; if (head != null) { if (Physics.Linecast(head.transform.position, end, out hitInfo, mask)) { base.transform.position = hitInfo.point; } else if (Physics.Linecast(head.transform.position - normalized * distanceMulti * 3f, end, out hitInfo, mask2)) { base.transform.position = hitInfo.point; } Debug.DrawLine(head.transform.position - normalized * distanceMulti * 3f, end, Color.red); } else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hitInfo, mask3)) { base.transform.position = hitInfo.point; } UpdateShake(); }
public override bool Init() { if (!base.Init()) return false; Effects.InitAll(Device); InputLayouts.InitAll(Device); RenderStates.InitAll(Device); Patch.InitPatchData(Terrain.CellsPerPatch, Device); _sky = new Sky(Device, "Textures/grasscube1024.dds", 5000.0f); var tii = new InitInfo { HeightMapFilename = null, LayerMapFilename0 = "textures/grass.dds", LayerMapFilename1 = "textures/darkdirt.dds", LayerMapFilename2 = "textures/stone.dds", LayerMapFilename3 = "Textures/lightdirt.dds", LayerMapFilename4 = "textures/snow.dds", BlendMapFilename = null, HeightScale = 50.0f, HeightMapWidth = 2049, HeightMapHeight = 2049, CellSpacing = 0.5f, Seed = 0, NoiseSize1 = 3.0f, Persistence1 = 0.7f, Octaves1 = 7, NoiseSize2 = 2.5f, Persistence2 = 0.8f, Octaves2 = 3, }; _terrain = new Terrain(); _terrain.Init(Device, ImmediateContext, tii); _camera.Height = _terrain.Height; _camera.SetLens(0.25f * MathF.PI, AspectRatio, 1.0f, 1000.0f); _ssao = new Ssao(Device, ImmediateContext, ClientWidth, ClientHeight, _camera.FovY, _camera.FarZ); _whiteTex = ShaderResourceView.FromFile(Device, "Textures/white.dds"); BuildScreenQuadGeometryBuffers(); _sMap = new ShadowMap(Device, SMapSize, SMapSize); _sceneBounds = new BoundingSphere(new Vector3(), MathF.Sqrt(_terrain.Width * _terrain.Width + _terrain.Depth * _terrain.Depth) / 2); _minimap = new Minimap(Device, ImmediateContext, MinimapSize, MinimapSize, _terrain, _camera); _sphereModel = BasicModel.CreateSphere(Device, 0.25f, 10, 10); _sphereModel.Materials[0] = new Material { Ambient = Color.Red, Diffuse = Color.Red, Specular = new Color4(32, 1.0f, 1.0f, 1.0f) }; _sphereModel.DiffuseMapSRV[0] = _whiteTex; _sphere = new BasicModelInstance {Model = _sphereModel}; _spherePos = new Vector3(float.MaxValue); return true; }
/// <summary> /// Initializes static members of the <see cref="HUDInfo" /> class. /// </summary> static HUDInfo() { double tinfoHeroDown; double panelHeroSizeX; float compareWidth; ScreenSize = new Vector2(Drawing.Width, Drawing.Height); if (ScreenSize.X == 0) { Console.WriteLine("Ensage couldnt determine your resolution, try to launch in window mode"); return; } minimap = new Minimap(new Vector2(-2, 1), new Vector2(0)); var ratio = Math.Floor((decimal)(ScreenSize.X / ScreenSize.Y * 100)); var largeMinimap = Game.GetConsoleVar("dota_hud_extra_large_minimap").GetInt() == 1; // Console.WriteLine("Your screen ratio is " + ratio); if (ratio == 213) { compareWidth = 1600; panelHeroSizeX = 45.28; tinfoHeroDown = 25.714; DireCompare = 2.402; RadiantCompare = 3.08; HpBarHeight = 7; HpBarWidth = 69; HpBarX = 36; HpBarY = 23; minimap.Size = new Vector2(0.1070833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 177) { compareWidth = 1600; panelHeroSizeX = 52.8900000000004; tinfoHeroDown = 25.714; DireCompare = 2.5001; RadiantCompare = 3.409; HpBarHeight = 10; HpBarWidth = 86.5; HpBarX = 44; HpBarY = 27; minimap.Size = new Vector2(0.1280833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 166) { compareWidth = 1280; panelHeroSizeX = 47.19; tinfoHeroDown = 25.714; DireCompare = 2.59; RadiantCompare = 3.64; HpBarHeight = 7.4; HpBarWidth = 71; HpBarX = 37; HpBarY = 22; minimap.Size = new Vector2(0.1370833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 160) { compareWidth = 1280; panelHeroSizeX = 48.95; tinfoHeroDown = 25.714; DireCompare = 2.609; RadiantCompare = 3.78; HpBarHeight = 9; HpBarWidth = 75; HpBarX = 38.3; HpBarY = 25; minimap.Size = new Vector2(0.1425833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 150) { compareWidth = 1024; panelHeroSizeX = 47.21; tinfoHeroDown = 25.714; DireCompare = 2.775; RadiantCompare = 4.57; HpBarHeight = 8; HpBarWidth = 79.2; HpBarX = 40.2; HpBarY = 24; minimap.Size = new Vector2(0.1500233333333333f * ScreenSize.X, 0.2200940740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 133) { compareWidth = 1280; panelHeroSizeX = 58.3; tinfoHeroDown = 25.714; DireCompare = 2.78; RadiantCompare = 4.65; HpBarHeight = 8; HpBarWidth = 71; HpBarX = 36.6; HpBarY = 23; minimap.Size = new Vector2(0.1690833333333333f * ScreenSize.X, 0.2225740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 125) { compareWidth = 1280; panelHeroSizeX = 58.3; tinfoHeroDown = 25.714; DireCompare = 2.78; RadiantCompare = 4.65; HpBarHeight = 11; HpBarWidth = 96.5; HpBarX = 49; HpBarY = 32; minimap.Size = new Vector2(0.1850833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else { Console.WriteLine( @"Your screen resolution is not supported and drawings might have wrong size/position, (" + ratio + ")"); compareWidth = 1600; panelHeroSizeX = 65; tinfoHeroDown = 25.714; DireCompare = 2.655; RadiantCompare = 5.985; HpBarHeight = 10; HpBarWidth = 83.5; HpBarX = 43; HpBarY = 28; minimap.Size = new Vector2(0.1270833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } if (largeMinimap) { const float LargeMinimapConstant = 1.1470833333333333f; // © Moones 2017 minimap.Size *= LargeMinimapConstant; minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } Monitor = ScreenSize.X / compareWidth; Rate = Math.Max(Monitor, 1); X = panelHeroSizeX * Monitor; y = ScreenSize.Y / tinfoHeroDown; var menu = new Menu.Menu("HUDInfo", nameof(HUDInfo)); var minimapOnRight = menu.AddItem( new MenuItem(menu.Name + "minimapRight", "Minimap is on the right").SetValue(false).SetTooltip("Enable this if you have minimap on the right")); minimapOnRight.ValueChanged += (sender, args) => { MinimapIsOnRight = args.GetNewValue <bool>(); }; MinimapIsOnRight = minimapOnRight.GetValue <bool>(); DelayAction.Add(200, () => Menu.Menu.Root.AddSubMenu(menu)); try { var mouse = new Rectangle(new Vector2(5, 5), Color.White); GameUpdate update = args => { var mousePos = Game.MousePosition; // if (Utils.SleepCheck("mouse")) // { // Console.WriteLine(mousePos); // Utils.Sleep(500, "mouse"); // } var minimapPos = mousePos.WorldToMinimap(); mouse.Position = minimapPos; }; var mipos = new Vector3(MapLeft, MapTop, 0).WorldToMinimap(); rectangle = new Rectangle(minimap.Size, new ColorBGRA(255, 255, 255, 25)) { Position = mipos }; var enableRectangle = menu.AddItem( new MenuItem(menu.Name + "enablerectangle", "Enable minimap debug") .SetTooltip("Draws rectangle over minimap in current e.common minimap size (requires -dx9), and shows current mouse position on minimap") .SetValue(false)); enableRectangle.SetValue(false); DrawingEndScene draw = eventArgs => { rectangle.Render(); mouse.Render(); }; enableRectangle.ValueChanged += (sender, args) => { if (args.GetNewValue <bool>()) { rectangle.Initialize(); mouse.Initialize(); Drawing.OnEndScene += draw; Game.OnUpdate += update; } else { rectangle.Dispose(); mouse.Dispose(); Drawing.OnEndScene -= draw; Game.OnUpdate -= update; } }; } catch (WrongRenderModeException e) { Console.WriteLine($"HUDInfo won't work due to dx9 restrictions."); } }
public override bool Init() { if (!base.Init()) return false; Effects.InitAll(Device); InputLayouts.InitAll(Device); RenderStates.InitAll(Device); Patch.InitPatchData(Terrain.CellsPerPatch, Device); _sky = new Sky(Device, "Textures/grasscube1024.dds", 5000.0f); var tii = new InitInfo { HeightMapFilename = null, LayerMapFilename0 = "textures/grass.dds", LayerMapFilename1 = "textures/darkdirt.dds", LayerMapFilename2 = "textures/stone.dds", LayerMapFilename3 = "Textures/lightdirt.dds", LayerMapFilename4 = "textures/snow.dds", BlendMapFilename = null, HeightScale = 50.0f, HeightMapWidth = 2049, HeightMapHeight = 2049, CellSpacing = 0.5f, Seed = 0, NoiseSize1 = 3.0f, Persistence1 = 0.7f, Octaves1 = 7, NoiseSize2 = 2.5f, Persistence2 = 0.8f, Octaves2 = 3, }; _terrain = new Terrain(); _terrain.Init(Device, ImmediateContext, tii); _camera.Height = _terrain.Height; AddUIElements(); _camera.SetLens(0.25f * MathF.PI, AspectRatio, 1.0f, 1000.0f); _ssao = new Ssao(Device, ImmediateContext, ClientWidth, ClientHeight, _camera.FovY, _camera.FarZ); _whiteTex = ShaderResourceView.FromFile(Device, "Textures/white.dds"); _sMap = new ShadowMap(Device, SMapSize, SMapSize); _sceneBounds = new BoundingSphere(new Vector3(), MathF.Sqrt(_terrain.Width * _terrain.Width + _terrain.Depth * _terrain.Depth) / 2); _minimap = new Minimap(Device, ImmediateContext, MinimapSize, MinimapSize, _terrain, _camera); return true; }
/// <summary> /// Eats a bite of rock cake if hitpoints are above 1 /// </summary> /// <returns>true if a bite of rock cake is taken</returns> protected bool Hitpoints() { if (TimeSinceLastOverload < overloadDrainTime || Numerical.CloseEnough(overloadBoostTime, TimeSinceLastOverload, 0.02)) { return(false); //an overload might be taking effect or wearing off } const double oneHitpoint = 0.035714285714285712; RectangleBounds hitpoints = Minimap.HitpointsDigitsArea(); double redHitpointsMatch = Vision.FractionalMatchPiece(HitpointsRed, hitpoints.Left, hitpoints.Right, hitpoints.Top, hitpoints.Bottom); if (Numerical.WithinRange(redHitpointsMatch, oneHitpoint, 0.01 * oneHitpoint) || (Minimap.Hitpoints() > 0.25)) { return(false); //hitpoints are already at 1 or an overload has just worn off and hitpoints are no longer red } Inventory.RightClickInventoryOption(0, 0, 1, false); //guzzle rock cake SafeWaitPlus(1000, 250); return(true); }
private void AddUIElements() { _panel = new FlowLayoutPanel { Dock = DockStyle.Top, AutoSize = true, FlowDirection = FlowDirection.LeftToRight }; _generateButton = new Button { Text = "Generate Terrain", AutoSize = true }; _generateButton.Click += (sender, args) => { Window.Cursor = Cursors.WaitCursor; Util.ReleaseCom(ref _terrain); _terrain = new Terrain(); var tii = new InitInfo { HeightMapFilename = null, LayerMapFilename0 = "textures/grass.dds", LayerMapFilename1 = "textures/darkdirt.dds", LayerMapFilename2 = "textures/stone.dds", LayerMapFilename3 = "Textures/lightdirt.dds", LayerMapFilename4 = "textures/snow.dds", BlendMapFilename = null, HeightScale = 50.0f, HeightMapWidth = 2049, HeightMapHeight = 2049, CellSpacing = 0.5f, Seed = (int)_txtSeed.Value, NoiseSize1 = (float)_txtNoise1.Value, Persistence1 = (float)_txtPersistence1.Value, Octaves1 = (int)_txtOctaves1.Value, NoiseSize2 = (float)_txtNoise2.Value, Persistence2 = (float)_txtPersistence2.Value, Octaves2 = (int)_txtOctaves2.Value }; _terrain.Init(Device, ImmediateContext, tii); _camera.Height = _terrain.Height; _hmImg.Image = _terrain.HeightMapImg; Util.ReleaseCom(ref _minimap); _minimap = new Minimap(Device, ImmediateContext, MinimapSize, MinimapSize, _terrain, _camera); Window.Cursor = Cursors.Default; }; var labelPadding = new Padding(0, 6, 0, 0); _lblSeed = new Label { Text = "Seed:", AutoSize = true, Padding = labelPadding }; _txtSeed = new NumericUpDown { Value = 0, AutoSize = true, Maximum = int.MaxValue }; _lblNoise1 = new Label { Text = "Noise:", AutoSize = true, Padding = labelPadding, }; _txtNoise1 = new NumericUpDown { Value = 3.0m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblPersistence1 = new Label { Text = "Persistence:", AutoSize = true, Padding = labelPadding }; _txtPersistence1 = new NumericUpDown { Value = 0.7m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblOctaves1 = new Label { Text = "Octaves:", AutoSize = true, Padding = labelPadding }; _txtOctaves1 = new NumericUpDown { Value = 7, AutoSize = true, Minimum = 1, Maximum = 20, }; _lblNoise2 = new Label { Text = "Noise:", AutoSize = true, Padding = labelPadding }; _txtNoise2 = new NumericUpDown { Value = 2.5m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblPersistence2 = new Label { Text = "Persistence:", AutoSize = true, Padding = labelPadding }; _txtPersistence2 = new NumericUpDown { Value = 0.8m, DecimalPlaces = 2, Minimum = 0m, Maximum = 10m, Increment = 0.1m, AutoSize = true }; _lblOctaves2 = new Label { Text = "Octaves:", AutoSize = true, Padding = labelPadding }; _txtOctaves2 = new NumericUpDown { Value = 3, AutoSize = true, Minimum = 1, Maximum = 20 }; _hmImg = new PictureBox { Image = _terrain.HeightMapImg, MaximumSize = new Size(64, 64), MinimumSize = new Size(64, 64), SizeMode = PictureBoxSizeMode.StretchImage, BackColor = Color.White }; _panel.Controls.Add(_lblNoise1); _panel.Controls.Add(_txtNoise1); _panel.Controls.Add(_lblPersistence1); _panel.Controls.Add(_txtPersistence1); _panel.Controls.Add(_lblOctaves1); _panel.Controls.Add(_txtOctaves1); _panel.Controls.Add(_lblNoise2); _panel.Controls.Add(_txtNoise2); _panel.Controls.Add(_lblPersistence2); _panel.Controls.Add(_txtPersistence2); _panel.Controls.Add(_lblOctaves2); _panel.Controls.Add(_txtOctaves2); _panel.SetFlowBreak(_txtOctaves2, true); _panel.Controls.Add(_lblSeed); _panel.Controls.Add(_txtSeed); _panel.Controls.Add(_generateButton); _tblLayout = new TableLayoutPanel { Dock = DockStyle.Top, AutoSize = true }; _tblLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); _tblLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); _tblLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); _tblLayout.Controls.Add(_panel, 0, 0); _tblLayout.Controls.Add(_hmImg, 1, 0); Window.Controls.Add(_tblLayout); }
private void Awake() { cam = GetComponent <Camera>(); Instance = this; }
// Use this for initialization void Start() { Transform[] stars = new Transform[3]; int tmpCnt = 0; Minimap minimap = new Minimap(); for (int i = 0; i < numbers.GetLength(0); i++) { for (int j = 0; j < numbers.GetLength(1); j++) { for (int k = 0; k < numbers.GetLength(2); k++) { //way // floor if ((numbers[i, j, k] / 10) % 100 == 1) { Transform tf = (Transform)Instantiate(floor, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // wall1 if ((numbers[i, j, k] / 10) % 100 == 11) { Transform tf = (Transform)Instantiate(wall1, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // wall2 if ((numbers[i, j, k] / 10) % 100 == 21) { Transform tf = (Transform)Instantiate(wall2, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // wall3 if ((numbers[i, j, k] / 10) % 100 == 31) { Transform tf = (Transform)Instantiate(wall3, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // goal if ((numbers[i, j, k] / 10) % 100 == 2) { Transform tf = (Transform)Instantiate(goal, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // moving plane --- if ((numbers[i, j, k] / 10) % 10 == 3) { MovingPlane mp = (MovingPlane)Instantiate(movingPlane, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); int length = (numbers[i, j, k] / 10) % 100 / 10; Debug.Log("val: " + numbers[i, j, k]); Debug.Log("length: " + length); if (numbers[i, j, k] % 10 == 1) { mp.direction = new Vector3(1f, 0f, 0f) * length; } else if (numbers[i, j, k] % 10 == 2) { mp.direction = new Vector3(0f, 0f, 1f) * length; } else if (numbers[i, j, k] % 10 == 3) { mp.direction = new Vector3(-1f, 0f, 0f) * length; } else if (numbers[i, j, k] % 10 == 0) { mp.direction = new Vector3(0f, 0f, -1f) * length; } } // moving plane | if ((numbers[i, j, k] / 10) % 10 == 4) { MovingPlane mp = (MovingPlane)Instantiate(movingPlane, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); int length = (numbers[i, j, k] / 10) % 100 / 10; mp.direction = new Vector3(0f, 1f, 0f) * length; } // slope if ((numbers[i, j, k] / 10) % 100 == 5) { Instantiate(slope, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // force walk if ((numbers[i, j, k] / 10) % 100 == 6) { Instantiate(forceWalk, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // ladder if ((numbers[i, j, k] / 10) % 100 == 7) { Instantiate(ladder, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // spring if ((numbers[i, j, k] / 10) % 100 == 8) { Instantiate(spring, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // warp if ((numbers[i, j, k] / 10) % 10 == 9) { int tmp = numbers[i, j, k] / 100; int t_z = tmp % 100; tmp /= 100; int t_y = tmp % 100; tmp /= 100; int t_x = tmp; Warp wp = (Warp)Instantiate(warp, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); wp.DestinationPosition = new Vector3(t_x, t_y, t_z) * 4; } // rotating floor if ((numbers[i, j, k] / 10) % 100 == 12) { Instantiate(rotatingFloor, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } // narrow floor if ((numbers[i, j, k] / 10) % 100 == 15) { Instantiate(narrowFloor, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } //player & star if ((numbers[i, j, k] / 1000) % 10000000 == 1) { Transform tmpPlayer = (Transform)Instantiate(player, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); minimap = tmpPlayer.GetComponentInChildren<Minimap>(); Debug.Log(minimap); } if ((numbers[i, j, k] / 1000) % 10000000 == 2) { Transform tmpStar = (Transform)Instantiate(star, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); stars[tmpCnt++] = tmpStar; } if ((numbers[i, j, k] / 1000) % 10000000 == 3) { Instantiate(enemy, new Vector3(j, i, k) * 4, direction[numbers[i, j, k] % 10]); } } } } for (int i = 0; i < 3; i++) { Debug.Log(minimap); minimap.GenerateBlip(stars[i].gameObject); } }
public EnemySpawner init(Minimap minimap, Transform playerShip) { this.minimap = minimap; this.playerShip = playerShip; return(this); }
public static void LoadLevel(int levelNumber, ContentManager content, GraphicsDevice graphics) { ClearCurrentLevelData(); TileMap = new TileMap("Level" + levelNumber, graphics, content); Minimap = new Minimap(TileMap.Map, content.Load<Texture2D>("Sprites\\Nest"), content.Load<Texture2D>("Sprites\\Lab"), graphics); Player.Position = GameHandler.TileMap.PlayerSpawn; Lab.Position = GameHandler.TileMap.LabPosition; Lab.Update(); // Update lab collision rect Interface.UpdateMiniMap(); CurrentLevel = levelNumber; SaveHandler.SaveGame(); }
private void OnGUI() { if (!modEnabled.Value || !Player.m_localPlayer) { return; } cursorStyle = new GUIStyle { richText = true, fontSize = coordFontSize.Value, alignment = alignment.Value }; cursorStyle.normal.textColor = cursorCoordFontColor.Value; playerStyle = new GUIStyle { richText = true, fontSize = coordFontSize.Value, alignment = alignment.Value }; playerStyle.normal.textColor = playerCoordFontColor.Value; windowStyle = GUI.skin.window; if (lastFontName != fontName.Value) // call when config changes { lastFontName = fontName.Value; Dbgl($"new font {fontName.Value}"); Font font = GetFont(fontName.Value, 20); if (font == null) { Dbgl($"new font not found"); } else { currentFont = font; } } if (currentFont != null && cursorStyle?.font?.name != currentFont.name) { Dbgl($"setting font {currentFont.name}"); cursorStyle.font = currentFont; playerStyle.font = currentFont; windowStyle.font = currentFont; } playerPos = showPlayerCoordinates.Value ? string.Format(playerString.Value, new Vector3(Player.m_localPlayer.transform.position.x, Player.m_localPlayer.transform.position.z, Player.m_localPlayer.transform.position.y)) : ""; if (Minimap.IsOpen() && showCursorCoordinates.Value) { Vector3 cursorV = Traverse.Create(Minimap.instance).Method("ScreenToWorldPoint", new object[] { Input.mousePosition }).GetValue <Vector3>(); cursorPos = string.Format(cursorString.Value, new Vector2(cursorV.x, cursorV.z)); } else { cursorPos = ""; } if (playerPos.Length + cursorPos.Length == 0) { return; } GUI.backgroundColor = windowBackgroundColor.Value; windowRect = GUILayout.Window(windowId, new Rect(windowRect.position, coordRect.position + (playerPos.Length > 0 && cursorPos.Length > 0 ? doubleSize.size : coordRect.size)), new GUI.WindowFunction(WindowBuilder), titleString.Value, windowStyle); if (!Input.GetKey(KeyCode.Mouse0) && (windowRect.x != coordPosition.Value.x || windowRect.y != coordPosition.Value.y)) { coordPosition.Value = new Vector2(windowRect.x, windowRect.y); //Dbgl($"{cursorPos} {playerPos} {coordRect} {secondRect} {doubleSize} {windowRect}"); } }
static void SetCameraPositionToEyeOnFPS(GameCamera __instance, float dt, ref Vector3 pos, ref Quaternion rot) { // Toggle FPS on H if (IsDown(_hotkey.Value) && Player.m_localPlayer != null && !Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible()) { CycleMode(); } //if (IsDown(new KeyboardShortcut(KeyCode.B))) //{ // CycleCamLockMode(); //} //if (IsDown(new KeyboardShortcut(KeyCode.V))) //{ // _configLimitCameraRotationWhenInIdleAnimation.Value = !_configLimitCameraRotationWhenInIdleAnimation.Value; // Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Changing lock mode to " + _configLimitCameraRotationWhenInIdleAnimation.Value); //} if (CurrentFPMode == FirstPersonModes.FirstPersonHelmet || CurrentFPMode == FirstPersonModes.FirstPersonNoBody || CurrentFPMode == FirstPersonModes.FirstPersonOnlyWeapons || CurrentFPMode == FirstPersonModes.FirstPersonNoHelmetAlt) { _head.localScale = _originalHeadScale; pos = _helmetAttach.position; } else if (CurrentFPMode == FirstPersonModes.FirstPersonNoHelmet) { _head.localScale = _originalHeadScale; pos = _helmetAttach.position; _head.localScale = new Vector3(0.0001f, 0.0001f, 0.0001f); } if (!IsThirdPerson(CurrentFPMode)) { UpdateRotation(Player.m_localPlayer, __instance, ref rot); } }
public override bool Init() { if (!base.Init()) return false; Effects.InitAll(Device); InputLayouts.InitAll(Device); RenderStates.InitAll(Device); Patch.InitPatchData(Terrain.CellsPerPatch, Device); _sky = new Sky(Device, "Textures/grasscube1024.dds", 5000.0f); var tii = new InitInfo { HeightMapFilename = null, LayerMapFilename0 = "textures/grass.png", LayerMapFilename1 = "textures/hills.png", LayerMapFilename2 = "textures/stone.png", LayerMapFilename3 = "Textures/lightdirt.dds", LayerMapFilename4 = "textures/snow.png", Material = new Material() { Ambient = Color.LightGray, Diffuse = Color.LightGray, Specular = new Color4(64, 0, 0, 0) }, BlendMapFilename = null, HeightScale = 50.0f, HeightMapWidth = 2049, HeightMapHeight = 2049, CellSpacing = 0.5f, Seed = MathF.Rand(), NoiseSize1 = 3.0f, Persistence1 = 0.7f, Octaves1 = 7, NoiseSize2 = 2.5f, Persistence2 = 0.8f, Octaves2 = 3, }; _terrain = new Terrain(); //_terrain.DebugQuadTree = true; _terrain.Init(Device, ImmediateContext, tii); _camera.Height = _terrain.Height; _camera.SetLens(0.25f * MathF.PI, AspectRatio, 1.0f, 1000.0f); _ssao = new Ssao(Device, ImmediateContext, ClientWidth, ClientHeight, _camera.FovY, _camera.FarZ); _whiteTex = ShaderResourceView.FromFile(Device, "Textures/white.dds"); _sMap = new ShadowMap(Device, SMapSize, SMapSize); _sceneBounds = new BoundingSphere(new Vector3(), MathF.Sqrt(_terrain.Width * _terrain.Width + _terrain.Depth * _terrain.Depth) / 2); _minimap = new Minimap(Device, ImmediateContext, MinimapSize, MinimapSize, _terrain, _camera); _sphereModel = new BasicModel(); _sphereModel.CreateSphere(Device, 0.25f, 10, 10); _sphereModel.Materials[0] = new Material { Ambient = new Color4(63, 0, 0), Diffuse = Color.Red, Specular = new Color4(32, 1.0f, 1.0f, 1.0f) }; _sphereModel.DiffuseMapSRV[0] = _whiteTex; _sphere = new BasicModelInstance(_sphereModel); _unit = new Unit(_sphere, _terrain.GetTile(511, 511), _terrain); FontCache.RegisterFont("bold", 16, "Courier New", FontWeight.Bold); return true; }
// this code is insanely stupid, and mostly my fault -- chrisf void PrepareMapResources(Manifest manifest, Map map) { Rules.LoadRules(manifest, map); tileset = Rules.TileSets[map.Tileset]; tileset.LoadTiles(); int[] ShadowIndex = { 3, 4 }; var palette = new Palette(FileSystem.Open(tileset.Palette), ShadowIndex); surface1.Bind(map, tileset, palette); // construct the palette of tiles var palettes = new[] { tilePalette, actorPalette, resourcePalette }; foreach (var p in palettes) { p.Visible = false; p.SuspendLayout(); } foreach (var tc in tileset.Templates.GroupBy(t => t.Value.Category)) { var category = tc.Key ?? "(Uncategorized)"; var categoryHeader = new Label { BackColor = SystemColors.Highlight, ForeColor = SystemColors.HighlightText, Text = category, AutoSize = false, Height = 24, TextAlign = ContentAlignment.MiddleLeft, Width = tilePalette.ClientSize.Width, }; // hook this manually, anchoring inside FlowLayoutPanel is flaky. tilePalette.Resize += (_, e) => categoryHeader.Width = tilePalette.ClientSize.Width; if (tilePalette.Controls.Count > 0) { tilePalette.SetFlowBreak( tilePalette.Controls[tilePalette.Controls.Count - 1], true); } tilePalette.Controls.Add(categoryHeader); foreach (var t in tc) { try { var bitmap = tileset.RenderTemplate((ushort)t.Key, palette); var ibox = new PictureBox { Image = bitmap, Width = bitmap.Width / 2, Height = bitmap.Height / 2, SizeMode = PictureBoxSizeMode.StretchImage }; var brushTemplate = new BrushTemplate { Bitmap = bitmap, N = t.Key }; ibox.Click += (_, e) => surface1.SetTool(new BrushTool(brushTemplate)); var template = t.Value; tilePalette.Controls.Add(ibox); tt.SetToolTip(ibox, "{1}:{0} ({2}x{3})".F( template.Image, template.Id, template.Size.X, template.Size.Y)); } catch { } } } var actorTemplates = new List <ActorTemplate>(); foreach (var a in Rules.Info.Keys) { try { var info = Rules.Info[a]; if (!info.Traits.Contains <RenderSimpleInfo>()) { continue; } var etf = info.Traits.GetOrDefault <EditorTilesetFilterInfo>(); if (etf != null && etf.ExcludeTilesets != null && etf.ExcludeTilesets.Contains(tileset.Id)) { continue; } if (etf != null && etf.RequireTilesets != null && !etf.RequireTilesets.Contains(tileset.Id)) { continue; } var template = RenderUtils.RenderActor(info, tileset, palette); var ibox = new PictureBox { Image = template.Bitmap, Width = 32, Height = 32, SizeMode = PictureBoxSizeMode.Zoom, BorderStyle = BorderStyle.FixedSingle }; ibox.Click += (_, e) => surface1.SetTool(new ActorTool(template)); actorPalette.Controls.Add(ibox); tt.SetToolTip(ibox, "{0}".F( info.Name)); actorTemplates.Add(template); } catch { } } surface1.BindActorTemplates(actorTemplates); var resourceTemplates = new List <ResourceTemplate>(); foreach (var a in Rules.Info["world"].Traits.WithInterface <ResourceTypeInfo>()) { try { var template = RenderUtils.RenderResourceType(a, tileset.Extensions, palette); var ibox = new PictureBox { Image = template.Bitmap, Width = 32, Height = 32, SizeMode = PictureBoxSizeMode.Zoom, BorderStyle = BorderStyle.FixedSingle }; ibox.Click += (_, e) => surface1.SetTool(new ResourceTool(template)); resourcePalette.Controls.Add(ibox); tt.SetToolTip(ibox, "{0}:{1}cr".F( template.Info.Name, template.Info.ValuePerUnit)); resourceTemplates.Add(template); } catch { } } surface1.BindResourceTemplates(resourceTemplates); foreach (var p in palettes) { p.Visible = true; p.ResumeLayout(); } pmMiniMap.Image = Minimap.AddStaticResources(surface1.Map, Minimap.TerrainBitmap(surface1.Map, true)); propertiesToolStripMenuItem.Enabled = true; resizeToolStripMenuItem.Enabled = true; saveToolStripMenuItem.Enabled = true; saveAsToolStripMenuItem.Enabled = true; mnuMinimapToPNG.Enabled = true; // todo: what is this VB naming bullshit doing here? PopulateActorOwnerChooser(); }
public override void Tick() { var hasRadarNew = world .ActorsWithTrait <ProvidesRadar>() .Any(a => a.Actor.Owner == world.LocalPlayer && a.Trait.IsActive); if (hasRadarNew != hasRadar) { radarAnimating = true; var eva = Rules.Info["world"].Traits.Get <EvaAlertsInfo>(); Sound.Play(hasRadarNew ? eva.RadarUp : eva.RadarDown); } hasRadar = hasRadarNew; // Build the radar image if (hasRadar) { --updateTicks; if (updateTicks <= 0) { updateTicks = 12; customTerrainSprite.sheet.Texture.SetData(Minimap.CustomTerrainBitmap(world)); } if (updateTicks == 8) { actorSprite.sheet.Texture.SetData(Minimap.ActorsBitmap(world)); } if (updateTicks == 4) { shroudSprite.sheet.Texture.SetData(Minimap.ShroudBitmap(world)); } } if (!radarAnimating) { return; } // Increment frame if (hasRadar) { radarAnimationFrame++; } else { radarAnimationFrame--; } // Calculate radar bin position if (radarAnimationFrame <= radarSlideAnimationLength) { radarOrigin = float2.Lerp(radarClosedOrigin, radarOpenOrigin, radarAnimationFrame * 1.0f / radarSlideAnimationLength); } // Minimap height if (radarAnimationFrame >= radarSlideAnimationLength) { radarMinimapHeight = float2.Lerp(0, 1, (radarAnimationFrame - radarSlideAnimationLength) * 1.0f / radarActivateAnimationLength); } // Animation is complete if (radarAnimationFrame == (hasRadar ? radarSlideAnimationLength + radarActivateAnimationLength : 0)) { radarAnimating = false; } }
void OnMapChanged() { MakeDirty(); pmMiniMap.Image = Minimap.AddStaticResources(surface1.Map, Minimap.TerrainBitmap(surface1.Map, true)); }
public GuiManager() { minimap = new Minimap(); }
private void Start() { Minimap.TrackGameObjectOnMinimap(base.gameObject, Color.white, false, true, Minimap.IconStyle.Supply); }
private void Start() { FengGameManagerMKII.FGM.AddCT(this); if (this.myHero == null) { this.findNearestHero(); } size = 20f; base.name = "COLOSSAL_TITAN"; this.NapeArmor = 1000; bool flag = false; if (FengGameManagerMKII.Level.RespawnMode == RespawnMode.NEVER) { flag = true; } if (IN_GAME_MAIN_CAMERA.Difficulty == 0) { this.NapeArmor = ((!flag) ? 5000 : 2000); } else if (IN_GAME_MAIN_CAMERA.Difficulty == 1) { this.NapeArmor = ((!flag) ? 8000 : 3500); foreach (object obj in base.animation) { AnimationState animationState = (AnimationState)obj; animationState.speed = 1.02f; } } else if (IN_GAME_MAIN_CAMERA.Difficulty == 2) { this.NapeArmor = ((!flag) ? 12000 : 5000); foreach (object obj2 in base.animation) { AnimationState animationState2 = (AnimationState)obj2; animationState2.speed = 1.05f; } } this.NapeArmorTotal = this.NapeArmor; this.state = "wait"; baseT.position += -Vectors.up * 10000f; if (FengGameManagerMKII.LAN) { base.GetComponent <PhotonView>().enabled = false; } else { base.GetComponent <NetworkView>().enabled = false; } this.door_broken = CacheGameObject.Find("door_broke"); this.door_closed = CacheGameObject.Find("door_fine"); this.door_broken.SetActive(false); this.door_closed.SetActive(true); Minimap.TrackGameObjectOnMinimap(gameObject, Color.black, false, true, Minimap.IconStyle.Circle); if (BasePV.IsMine) { if (GameModes.SizeMode.Enabled) { size = UnityEngine.Random.Range(GameModes.SizeMode.GetFloat(0), GameModes.SizeMode.GetFloat(1)); BasePV.RPC("setSize", PhotonTargets.AllBuffered, new object[] { size }); } if (GameModes.HealthMode.Enabled) { int healthLower = GameModes.HealthMode.GetInt(0); int healthUpper = GameModes.HealthMode.GetInt(1) + 1; if (GameModes.HealthMode.Selection == 1) { maxHealth = (NapeArmor = UnityEngine.Random.Range(healthLower, healthUpper)); } else if (GameModes.HealthMode.Selection == 2) { maxHealth = (NapeArmor = Mathf.Clamp(Mathf.RoundToInt(size / 4f * (float)UnityEngine.Random.Range(healthLower, healthUpper)), healthLower, healthUpper)); } } else { maxHealth = NapeArmor; } this.lagMax = 150f + size * 3f; this.healthTime = 0f; if (NapeArmor > 0 && IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer) { BasePV.RPC("labelRPC", PhotonTargets.AllBuffered, new object[] { NapeArmor, Mathf.RoundToInt(maxHealth) }); } LoadSkin(); } spawned = true; }
public static void Create([Aliases("t")] string type, [Aliases("i")] string input, [Aliases("o")] string output) { switch ((CreateType)Enum.Parse(typeof(CreateType), type, true)) { case CreateType.Minimap: var minimap = File.Exists(input) ? Minimap.Create(new World(InputType.JSON, File.ReadAllText(input))) : Minimap.Create(new World(InputType.BigDB, input)); minimap.Save(Path.GetFullPath(output)); break; case CreateType.ExportJSON: File.WriteAllText(Path.GetFullPath(output), new World(InputType.BigDB, input, null).Serialize(OutputType.JSON)); break; } Environment.Exit(0); }
/// <summary> /// Initializes static members of the <see cref="HUDInfo" /> class. /// </summary> static HUDInfo() { double tinfoHeroDown; double panelHeroSizeX; float compareWidth; ScreenSize = new Vector2(Drawing.Width, Drawing.Height); if (ScreenSize.X == 0) { Console.WriteLine("Ensage couldnt determine your resolution, try to launch in window mode"); return; } minimap = new Minimap(new Vector2(-2, 1), new Vector2(0)); var ratio = Math.Floor((decimal)(ScreenSize.X / ScreenSize.Y * 100)); var largeMinimap = Game.GetConsoleVar("dota_hud_extra_large_minimap").GetInt() == 1; // Console.WriteLine("Your screen ratio is " + ratio); if (ratio == 213) { compareWidth = 1600; panelHeroSizeX = 45.28; tinfoHeroDown = 25.714; DireCompare = 2.402; RadiantCompare = 3.08; HpBarHeight = 7; HpBarWidth = 69; HpBarX = 36; HpBarY = 23; minimap.Size = new Vector2(0.1070833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 177) { compareWidth = 1600; panelHeroSizeX = 52.8900000000004; tinfoHeroDown = 25.714; DireCompare = 2.5001; RadiantCompare = 3.409; HpBarHeight = 10; HpBarWidth = 86.5; HpBarX = 44; HpBarY = 27; minimap.Size = new Vector2(0.1280833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 166) { compareWidth = 1280; panelHeroSizeX = 47.19; tinfoHeroDown = 25.714; DireCompare = 2.59; RadiantCompare = 3.64; HpBarHeight = 7.4; HpBarWidth = 71; HpBarX = 37; HpBarY = 22; minimap.Size = new Vector2(0.1370833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 160) { compareWidth = 1280; panelHeroSizeX = 48.95; tinfoHeroDown = 25.714; DireCompare = 2.609; RadiantCompare = 3.78; HpBarHeight = 9; HpBarWidth = 75; HpBarX = 38.3; HpBarY = 25; minimap.Size = new Vector2(0.1425833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 150) { compareWidth = 1024; panelHeroSizeX = 47.21; tinfoHeroDown = 25.714; DireCompare = 2.775; RadiantCompare = 4.57; HpBarHeight = 8; HpBarWidth = 79.2; HpBarX = 40.2; HpBarY = 24; minimap.Size = new Vector2(0.1500233333333333f * ScreenSize.X, 0.2200940740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 133) { compareWidth = 1280; panelHeroSizeX = 58.3; tinfoHeroDown = 25.714; DireCompare = 2.78; RadiantCompare = 4.65; HpBarHeight = 8; HpBarWidth = 71; HpBarX = 36.6; HpBarY = 23; minimap.Size = new Vector2(0.1690833333333333f * ScreenSize.X, 0.2225740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else if (ratio == 125) { compareWidth = 1280; panelHeroSizeX = 58.3; tinfoHeroDown = 25.714; DireCompare = 2.78; RadiantCompare = 4.65; HpBarHeight = 11; HpBarWidth = 96.5; HpBarX = 49; HpBarY = 32; minimap.Size = new Vector2(0.1850833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } else { Console.WriteLine( @"Your screen resolution is not supported and drawings might have wrong size/position, (" + ratio + ")"); compareWidth = 1600; panelHeroSizeX = 65; tinfoHeroDown = 25.714; DireCompare = 2.655; RadiantCompare = 5.985; HpBarHeight = 10; HpBarWidth = 83.5; HpBarX = 43; HpBarY = 28; minimap.Size = new Vector2(0.1270833333333333f * ScreenSize.X, 0.2240740740740741f * ScreenSize.Y); minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } if (largeMinimap) { const float LargeMinimapConstant = 1.1470833333333333f; // © Moones 2017 minimap.Size *= LargeMinimapConstant; minimapMapScaleX = minimap.Size.X / mapWidth; minimapMapScaleY = minimap.Size.Y / mapHeight; } Monitor = ScreenSize.X / compareWidth; Rate = Math.Max(Monitor, 1); X = panelHeroSizeX * Monitor; y = ScreenSize.Y / tinfoHeroDown; var menu = new Menu.Menu("HUDInfo", nameof(HUDInfo)); var minimapOnRight = menu.AddItem( new MenuItem(menu.Name + "minimapRight", "Minimap is on the right").SetValue(false).SetTooltip("Enable this if you have minimap on the right")); minimapOnRight.ValueChanged += (sender, args) => { MinimapIsOnRight = args.GetNewValue <bool>(); }; MinimapIsOnRight = minimapOnRight.GetValue <bool>(); DelayAction.Add(200, () => Menu.Menu.Root.AddSubMenu(menu)); }
// Use this for initialization void Awake() { _instance = this; playerIcon = transform.Find("PlayerIcon"); }
// Use this for initialization void Start() { // Calculate the message position on the screen fEndMessagePosY = Screen.height - (fEndMessageHeight * 1.5f); rectEndMessage = new Rect(Screen.width * 0.5f - fEndMessageWidth * 0.5f, fEndMessagePosY, fEndMessageWidth, fEndMessageHeight); // Cache the main script scriptMainScript = GameObject.Find("/Codigo").GetComponent<MainScript>(); // Minimap script GameObject goMinimapCam = GameObject.FindWithTag("MinimapCam"); scriptMinimap = goMinimapCam.GetComponent<Minimap>(); // Hud object tHud = GameObject.Find("/HUD").transform; goMainCamera = GameObject.FindWithTag("MainCamera"); // All the monkeys in the game lAllMonkeys = scriptMainScript.GetListOfAllMonkeys(); SetupCameras(); DeathSequence(); }
// ReSharper disable once InconsistentNaming private static void Postfix(Minimap __instance, Minimap.PinData pin) { CurrentPin = pin; }
void OnMapChanged() { MakeDirty(); pmMiniMap.Image = Minimap.AddStaticResources(surface1.Map, Minimap.TerrainBitmap(surface1.Map, true)); cashToolStripStatusLabel.Text = CalculateTotalResource().ToString(); }
// Use this for initialization void Start() { // Cache the main script scriptMainScript = GameObject.Find("/Codigo").GetComponent<MainScript>(); // Get all needed objects camLaunchCam = this.camera; // Minimap script GameObject goMinimapCam = GameObject.FindWithTag("MinimapCam"); scriptMinimap = goMinimapCam.GetComponent<Minimap>(); // Hud object tHud = GameObject.Find("/HUD").transform; // Rocket Object GameObject[] goRockets = GameObject.FindGameObjectsWithTag("Rocket"); foreach(GameObject goRocket in goRockets) { if(goRocket.name == "Rocket") { tRocket = goRocket.transform; break; } } // Rocket engine thrust tRocketThrust = tRocket.transform.Find("RocketThrust"); if(!tRocketThrust) { // DEBUG Debug.LogError(this.transform + " cannot find the rocket thrust particle system"); } // Comment the line below to test the launching LaunchingSequence(); }
public override void Tick() { // Enable/Disable the radar var enabled = IsEnabled(); if (enabled != cachedEnabled) { Sound.Play(enabled ? RadarOnlineSound : RadarOfflineSound); } cachedEnabled = enabled; if (enabled) { var rp = world.RenderPlayer; var newRenderShroud = rp != null ? rp.Shroud : null; if (newRenderShroud != renderShroud) { if (renderShroud != null) { renderShroud.CellsChanged -= MarkShroudDirty; } if (newRenderShroud != null) { // Redraw the full shroud sprite using (var bitmap = Minimap.ShroudBitmap(world)) OpenRA.Graphics.Util.FastCopyIntoSprite(shroudSprite, bitmap); // Update the notification binding newRenderShroud.CellsChanged += MarkShroudDirty; } dirtyShroudCells.Clear(); renderShroud = newRenderShroud; } // The actor layer is updated every tick var stride = radarSheet.Size.Width; var dx = actorSprite.Bounds.Left - world.Map.Bounds.Left; var dy = actorSprite.Bounds.Top - world.Map.Bounds.Top; Array.Clear(radarData, 4 * (actorSprite.Bounds.Top * stride + actorSprite.Bounds.Left), 4 * actorSprite.Bounds.Height * stride); unsafe { fixed(byte *colorBytes = &radarData[0]) { var colors = (int *)colorBytes; foreach (var t in world.ActorsWithTrait <IRadarSignature>()) { if (!t.Actor.IsInWorld || world.FogObscures(t.Actor)) { continue; } foreach (var cell in t.Trait.RadarSignatureCells(t.Actor)) { var uv = cell.First.ToMPos(world.Map); if (world.Map.Bounds.Contains(uv.U, uv.V)) { colors[(uv.V + dy) * stride + uv.U + dx] = cell.Second.ToArgb(); } } } } } } var targetFrame = enabled ? AnimationLength : 0; hasRadar = enabled && frame == AnimationLength; if (frame == targetFrame) { return; } frame += enabled ? 1 : -1; radarMinimapHeight = float2.Lerp(0, 1, (float)frame / AnimationLength); Animating(frame * 1f / AnimationLength); // Update map rectangle for event handling var ro = RenderOrigin; mapRect = new Rectangle(previewOrigin.X + ro.X, previewOrigin.Y + ro.Y, mapRect.Width, mapRect.Height); // Animation is complete if (frame == targetFrame) { if (enabled) { AfterOpen(); } else { AfterClose(); } } }
public override void Apply() { ApplySkybox(); int index = 0; GameObject[] objects = (GameObject[])GameObject.FindObjectsOfType(typeof(GameObject)); foreach (GameObject go in objects) { if (go == null) { continue; } if (go.name.Contains("Cube_") && go.transform.parent.gameObject.tag != "Player") { int elementIntex = 0; bool canBe = false; switch (go.name.Substring(5, 3)) { case "001": elementIntex = GroundIndex; canBe = true; break; case "006": case "007": case "015": case "000": case "labelWall": elementIntex = WallIndex; break; case "002": Vector3 pos = go.transform.position; if (pos.x == 0f && pos.y == 0f && pos.z == 0f) { goto case "labelWall"; } goto case "labelHouse"; case "005": case "003": case "labelHouse": int houseIndex; int.TryParse(random[index++].ToString(), out houseIndex); if (houseIndex < 0 || houseIndex >= 8) { houseIndex = Random.Range(0, 8); } elementIntex = HouseIndexStart + houseIndex; break; case "019": case "020": elementIntex = GateIndex; break; default: continue; } foreach (Renderer rend in go.GetComponentsInChildren <Renderer>()) { TryApplyTexture(elements[elementIntex], rend, canBe); } } } Minimap.TryRecaptureInstance(); }
void Start() { map = GetComponentInParent<Minimap>(); myRectTransform = GetComponent<RectTransform>(); }
public void HandleChat() { if (!(Chat.instance != null)) { return; } if (Chat.instance.m_chatWindow.gameObject.activeInHierarchy) { string text = Chat.instance.m_input.text; _ = Chat.instance.m_output.text; if ((Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace) || Input.GetKeyDown(KeyCode.Escape)) && ((SkConfigEntry.CAllowExecuteOnClear != null && !SkConfigEntry.CAllowExecuteOnClear.Value) || SkConfigEntry.CAllowExecuteOnClear == null)) { chatInLastMessage = string.Empty; } if (!text.Equals(string.Empty) && !text.Equals(consoleLastMessage)) { chatInLastMessage = text; } if (text.Equals(string.Empty) && !chatInLastMessage.Equals(string.Empty)) { SkCommandProcessor.ProcessCommands(chatInLastMessage, SkCommandProcessor.LogTo.Chat); chatInLastMessage = string.Empty; } } if (Input.GetKeyDown(KeyCode.Slash) && Player.m_localPlayer != null && SkConfigEntry.COpenConsoleWithSlash != null && !SkConfigEntry.COpenConsoleWithSlash.Value && SkConfigEntry.COpenChatWithSlash != null && SkConfigEntry.COpenChatWithSlash.Value && !Console.IsVisible() && !Chat.instance.IsChatDialogWindowVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible()) { Chat.instance.SetPrivateField("m_hideTimer", 0f); Chat.instance.m_chatWindow.gameObject.SetActive(value: true); Chat.instance.m_input.gameObject.SetActive(value: true); Chat.instance.m_input.ActivateInputField(); } }
// this code is insanely stupid, and mostly my fault -- chrisf void PrepareMapResources(ModData modData, Map map) { Program.Rules = map.Rules; tileset = Program.Rules.TileSets[map.Tileset]; tilesetRenderer = new TileSetRenderer(tileset, modData.Manifest.TileSize); var shadowIndex = new int[] { 3, 4 }; var palette = new ImmutablePalette(GlobalFileSystem.Open(tileset.Palette), shadowIndex); // required for desert terrain in RA var playerPalette = tileset.PlayerPalette ?? tileset.Palette; var shadowedPalette = new ImmutablePalette(GlobalFileSystem.Open(playerPalette), shadowIndex); surface1.Bind(map, tileset, tilesetRenderer, palette, shadowedPalette); // construct the palette of tiles var palettes = new[] { tilePalette, actorPalette, resourcePalette }; foreach (var p in palettes) { p.Visible = false; p.SuspendLayout(); } var templateOrder = tileset.EditorTemplateOrder ?? new string[] { }; foreach (var tc in tileset.Templates.GroupBy(t => t.Value.Category).OrderBy(t => templateOrder.IndexOf(t.Key))) { var category = tc.Key ?? "(Uncategorized)"; var categoryHeader = new Label { BackColor = SystemColors.Highlight, ForeColor = SystemColors.HighlightText, Text = category, AutoSize = false, Height = 24, TextAlign = ContentAlignment.MiddleLeft, Width = tilePalette.ClientSize.Width, }; // hook this manually, anchoring inside FlowLayoutPanel is flaky. tilePalette.Resize += (_, e) => categoryHeader.Width = tilePalette.ClientSize.Width; if (tilePalette.Controls.Count > 0) { tilePalette.SetFlowBreak( tilePalette.Controls[tilePalette.Controls.Count - 1], true); } tilePalette.Controls.Add(categoryHeader); foreach (var t in tc) { try { var bitmap = tilesetRenderer.RenderTemplate((ushort)t.Key, palette); var ibox = new PictureBox { Image = bitmap, Width = bitmap.Width / 2, Height = bitmap.Height / 2, SizeMode = PictureBoxSizeMode.StretchImage }; var brushTemplate = new BrushTemplate { Bitmap = bitmap, N = t.Key }; ibox.Click += (_, e) => surface1.SetTool(new BrushTool(brushTemplate)); var template = t.Value; tilePalette.Controls.Add(ibox); tt.SetToolTip(ibox, "{1}:{0} ({2}x{3})".F(template.Images[0], template.Id, template.Size.X, template.Size.Y)); } catch { } } } var actorTemplates = new List <ActorTemplate>(); foreach (var a in Program.Rules.Actors.Keys) { try { var info = Program.Rules.Actors[a]; if (!info.Traits.Contains <ILegacyEditorRenderInfo>()) { continue; } var etf = info.Traits.GetOrDefault <EditorTilesetFilterInfo>(); if (etf != null && etf.ExcludeTilesets != null && etf.ExcludeTilesets.Contains(tileset.Id)) { continue; } if (etf != null && etf.RequireTilesets != null && !etf.RequireTilesets.Contains(tileset.Id)) { continue; } var templatePalette = shadowedPalette; var rsi = info.Traits.GetOrDefault <ILegacyEditorRenderInfo>(); // exception for desert buildings if (rsi != null && rsi.EditorPalette != null && rsi.EditorPalette.Contains("terrain")) { templatePalette = palette; } var race = Program.Rules.Actors["world"].Traits.WithInterface <CountryInfo>().First().Race; var sequenceProvider = Program.Rules.Sequences[tileset.Id]; var template = RenderUtils.RenderActor(info, sequenceProvider, tileset, templatePalette, race); var ibox = new PictureBox { Image = template.Bitmap, Width = 32, Height = 32, SizeMode = PictureBoxSizeMode.Zoom, BorderStyle = BorderStyle.FixedSingle }; ibox.Click += (_, e) => surface1.SetTool(new ActorTool(template)); actorPalette.Controls.Add(ibox); tt.SetToolTip(ibox, "{0}".F(info.Name)); actorTemplates.Add(template); } catch { } } surface1.BindActorTemplates(actorTemplates); var resourceTemplates = new List <ResourceTemplate>(); foreach (var a in Program.Rules.Actors["world"].Traits.WithInterface <ResourceTypeInfo>()) { try { var template = RenderUtils.RenderResourceType(a, tileset, shadowedPalette); var ibox = new PictureBox { Image = template.Bitmap, Width = 32, Height = 32, SizeMode = PictureBoxSizeMode.Zoom, BorderStyle = BorderStyle.FixedSingle }; ibox.Click += (_, e) => surface1.SetTool(new ResourceTool(template)); resourcePalette.Controls.Add(ibox); tt.SetToolTip(ibox, "{0}:{1}cr".F(template.Info.Name, template.Info.ValuePerUnit)); resourceTemplates.Add(template); } catch { } } surface1.BindResourceTemplates(resourceTemplates); foreach (var p in palettes) { p.Visible = true; p.ResumeLayout(); } miniMapBox.Image = Minimap.RenderMapPreview(tileset, surface1.Map, true); propertiesToolStripMenuItem.Enabled = true; toolStripMenuItemProperties.Enabled = true; resizeToolStripMenuItem.Enabled = true; toolStripMenuItemResize.Enabled = true; saveToolStripMenuItem.Enabled = true; toolStripMenuItemSave.Enabled = true; saveAsToolStripMenuItem.Enabled = true; miniMapToPng.Enabled = true; PopulateActorOwnerChooser(); }
void Awake() { _instance = this; }