public NodeCursor(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth) { penCursorMini = new Pen(new SolidBrush(Color.FromArgb(180, Color.Wheat)), 2); brushCellMarker = new SolidBrush(Color.FromArgb(40, Color.Yellow)); brushCursorMini = new SolidBrush(Color.FromArgb(200, Color.White)); }
public NodeUIDialog(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth) { buttons = new List<NodeUIButton>(); doStep(); // This will set the initial positions }
void Start() { SFServer = SmartFoxConnection.Connection; this.PlayerRB = this.GetComponent<Rigidbody>(); this.MecAnim = this.GetComponentInChildren<Animator>(); theUI = (GameUI)FindObjectOfType(typeof(GameUI)); }
/// <summary> /// Strong Construction /// </summary> /// <param name="myCell"></param> /// <param name="myGameUI"></param> /// <param name="myPuzzleLocation"></param> /// <param name="myDepth"></param> public NodeCell(GameUI myGameUI, Cell myCell, VectorInt myPuzzleLocation, int myDepth) : base(myGameUI, myDepth) { Cell = myCell; puzzleLocation = myPuzzleLocation; Size = GameUI.GameCoords.GlobalTileSize; CurrentAbsolute = GameUI.GameCoords.PositionAbsoluteFromPuzzle(puzzleLocation); if (CurrentAbsolute == null) throw new InvalidOperationException(); DockPoint = DockPoint.TopLeft; switch (myCell) { case (Cell.Void): TileImage = GameUI.ResourceManager["Void"].LoadBitmap(); break; case (Cell.Floor): TileImage = GameUI.ResourceManager["Floor"].LoadBitmap(); break; case (Cell.Crate): TileImage = GameUI.ResourceManager["Crate"].LoadBitmap(); break; case (Cell.Player): TileImage = GameUI.ResourceManager["Player"].LoadBitmap(); break; case (Cell.Goal): TileImage = GameUI.ResourceManager["Goal"].LoadBitmap(); break; case (Cell.Wall): TileImage = GameUI.ResourceManager["Wall"].LoadBitmap(); break; } }
public NodeUIDialogPuzzleWin(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth) { NodeUIButton buttonNext; NodeUIButton buttonCancel; NodeUIButton buttonSave; NodeUIButton buttonExit; buttonNext = new NodeUIButton(myGameUI, myDepth + 1, CurrentAbsolute, "$Graphics/Icons/Right.png", "Next"); buttonCancel = new NodeUIButton(myGameUI, myDepth + 1, CurrentAbsolute, "$Graphics/Icons/Cancel.png", "Cancel"); buttonSave = new NodeUIButton(myGameUI, myDepth + 1, CurrentAbsolute, "$Graphics/Icons/Save.png", "Save"); buttonExit = new NodeUIButton(myGameUI, myDepth + 1, CurrentAbsolute, "$Graphics/Icons/Home.png", "Home"); buttonNext.ToolTip = "Start the next puzzle"; buttonCancel.ToolTip = "Redo this puzzle"; buttonSave.ToolTip = "Save the solution to the library"; buttonExit.ToolTip = "Return to home page"; Add(buttonNext); Add(buttonCancel); Add(buttonSave); Add(buttonExit); Text = @"Congrats! You have solved the puzzle. Do you want to continue with the next puzzle in the library? Again, well done!"; TextTitle = "Puzzle Complete"; }
/// <summary> /// Strong Construction /// </summary> /// <param name="myCell"></param> /// <param name="myGameUI"></param> /// <param name="myPuzzleLocation"></param> /// <param name="myDepth"></param> public NodeCell(GameUI myGameUI, Cell myCell, VectorInt myPuzzleLocation, int myDepth) : base(myGameUI, myDepth) { Cell = myCell; puzzleLocation = myPuzzleLocation; Size = GameUI.GameCoords.GlobalTileSize; CurrentAbsolute = GameUI.GameCoords.PositionAbsoluteFromPuzzle(puzzleLocation); if (CurrentAbsolute.IsNull) throw new InvalidOperationException(); DockPoint = DockPoint.TopLeft; switch (myCell) { case (Cell.Void): TileImage = GameUI.ResourceFactory[ResourceID.GameTileVoid].DataAsImage; break; case (Cell.Floor): TileImage = GameUI.ResourceFactory[ResourceID.GameTileFloor].DataAsImage; break; case (Cell.Crate): TileImage = GameUI.ResourceFactory[ResourceID.GameTileCrate].DataAsImage; break; case (Cell.Player): TileImage = GameUI.ResourceFactory[ResourceID.GameTilePlayer].DataAsImage; break; case (Cell.Goal): TileImage = GameUI.ResourceFactory[ResourceID.GameTileGoal].DataAsImage; break; case (Cell.Wall): TileImage = GameUI.ResourceFactory[ResourceID.GameTileWall].DataAsImage; break; } }
public override void Update(GameUI.ArenaUI hud, GameTime dt, GameUI.Input.InputState input) { base.Update(hud, dt, input); if (KeyboardExtensions.GetKeyDownState(input.CurrentKeyboardStates[0], Keys.C, this)) this.Visible = !this.Visible; }
public NodeEffectCircle(GameUI myGameUI, int myDepth, VectorInt myPos) : base(myGameUI, myDepth) { CurrentAbsolute = myPos; Path = new Linear(new VectorInt(10, 10), new VectorInt(32, 32), new VectorDouble(1, 1), false); pen = new Pen(Color.Goldenrod, 1.5f); }
public NodeTitle(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth, myGameUI.Puzzle.Details.Name, new Font("Lucida Console", 17f), new SolidBrush(Color.Yellow), new SolidBrush(Color.DarkOrange), new VectorInt(myGameUI.GameCoords.WindowRegion.TopMiddle.Add(-50, 3))) { secondLine = new NodeEffectText(myGameUI, myDepth - 1, "Sokoban rocks!", CurrentAbsolute.Add(0, 30)); secondLine.Brush = new SolidBrush(secondLineColour); secondLine.Font = new Font("Arial", 11f); secondLine.IsVisible = false; currentLine = 0; lines = GetTextLines().ToArray(); myGameUI.Add(secondLine); chain = new ActionChain(); chain.Add(new ActionMethod(SelectNextMessage)); chain.Add(new ActionCounter(20, 250, 4, new ActionDelegate(SetAlpha))); // FadeIn chain.Add(new ActionCounter(0, 50)); // wait chain.Add(new ActionCounter(250, 0, -7, new ActionDelegate(SetAlpha))); // FadeOut chain.Add(new ActionRetartChain(chain)); chain.Init(); }
void Awake() { if(instance == null) instance = this; areaRitualTestButton.onClick.AddListener(() => { Rituals.CompleteRitual(); }); }
void Awake() { _timer = levelTime; _ui = GetComponent<GameUI>(); _fader = GameObject.FindGameObjectWithTag(Tags.ScreenFader).GetComponent<ScreenFader>(); StartCoroutine(_fader.StartLevel()); SetupCollisionLayers(); }
// Use this for initialization void Awake() { instance = this; currentScore = 0; youWinText.enabled = false; highScoreText.enabled = false; restartButton.GetComponentInChildren<Text>().enabled = false; restartButton.GetComponent<Image>().enabled = false; }
// Use this for initialization void Start () { HotspotIndicator = this.GetComponent<SpriteRenderer>(); gameUI = GameObject.Find("GameUI").GetComponent<GameUI>(); HotspotIndicator.enabled = !gameUI.HideHotspots; // Hide all hotspots hotspotRadius = transform.localScale.x; }
// Use this for initialization void Awake() { monsterTr = this.gameObject.GetComponent<Transform>(); playerTr = GameObject.FindWithTag("Player").GetComponent<Transform>(); navMeshAgent = this.gameObject.GetComponent<NavMeshAgent>(); animator = this.GetComponent<Animator>(); _gameUI = GameObject.Find("GameUI").GetComponent<GameUI>(); }
public NodeControllerCommands(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth) { RectangleInt panel = myGameUI.GameCoords.PositionMovementCommands; VectorInt locCommands = myGameUI.GameCoords.PositionMovementCommands.TopLeft; NodeUIButton buttonUp = new NodeUIButton(myGameUI, myDepth + 1, locCommands.Add(22, 2), ResourceID.GameButtonUp, "Up"); buttonUp.CurrentCentre = panel.TopMiddle; buttonUp.ToolTip = "Move Up"; buttonUp.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonUp); NodeUIButton buttonDown = new NodeUIButton(myGameUI, myDepth + 2, locCommands.Add(22, 42), ResourceID.GameButtonDown, "Down"); buttonDown.CurrentCentre = panel.BottomMiddle; buttonDown.ToolTip = "Move Down"; buttonDown.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonDown); NodeUIButton buttonLeft = new NodeUIButton(myGameUI, myDepth + 3, locCommands.Add(2, 22), ResourceID.GameButtonLeft, "Left"); buttonLeft.CurrentCentre = panel.MiddleLeft; buttonLeft.ToolTip = "Move Left"; buttonLeft.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonLeft); NodeUIButton buttonRight = new NodeUIButton(myGameUI, myDepth + 4, locCommands.Add(42, 22), ResourceID.GameButtonRight, "Right"); buttonRight.CurrentCentre = panel.MiddleRight; buttonRight.ToolTip = "Move Right"; buttonRight.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonRight); NodeUIButton buttonUndo = new NodeUIButton(myGameUI, myDepth + 6, locCommands.Add(22, 22), ResourceID.GameButtonUndo, "Undo"); buttonUndo.CurrentCentre = panel.Center; buttonUndo.ToolTip = "Undo last move"; buttonUndo.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonUndo); RectangleInt panelGen = myGameUI.GameCoords.PositionGeneralCommands; NodeUIButton buttonRestart = new NodeUIButton(myGameUI, myDepth + 7, locCommands.Add(42, 42), ResourceID.GameButtonRestart, "Restart"); buttonRestart.CurrentCentre = panelGen.MiddleLeft; buttonRestart.ToolTip = "Restart puzzle"; buttonRestart.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonRestart); NodeUIButton buttonExit = new NodeUIButton(myGameUI, myDepth + 8, locCommands.Add(42, 2), ResourceID.GameButtonCancel, "Exit"); buttonExit.CurrentCentre = panelGen.Center; buttonExit.ToolTip = "Give up and exit"; buttonExit.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonExit); NodeUIButton buttonHelp = new NodeUIButton(myGameUI, myDepth + 5, locCommands.Add(2, 42), ResourceID.GameButtonHelp, "Help"); buttonHelp.CurrentCentre = panelGen.MiddleRight; buttonHelp.ToolTip = "Get a hint"; buttonHelp.OnClick += new EventHandler<NotificationEvent>(Button_OnClick); myGameUI.Add(buttonHelp); }
// Use this for initialization void Start() { ourGameUI = GameObject.Find("SceneScriptsObject").GetComponent<GameUI>(); ourGWM = GameObject.Find("SceneScriptsObject").GetComponent<GameWorldManager>(); ourPlayerActionDictionary.Add("Resource", new GatherResourceAction()); ourPlayerActionDictionary.Add("Center Node", new CenterNodeAction()); ourPlayerActionDictionary.Add("Use Item", new UseItemAction()); ourPlayerActionDictionary.Add("ContributeCenterNode", new ContributeCenterNodeAction()); }
/// <summary> /// Full Constructor. /// </summary> /// <param name="myGameUI">GameUI</param> /// <param name="myDepth">Depth Z-order</param> /// <param name="brush">Text Font Brush</param> /// <param name="brushShaddow">Shaddow Brush (Null for none)</param> /// <param name="text">Message</param> /// <param name="font">Text Font</param> public NodeEffectText(GameUI myGameUI, int myDepth, string text, Font font, Brush brush, Brush brushShaddow, VectorInt start) : base(myGameUI, myDepth) { CurrentAbsolute = start; this.brush = brush; this.brushShaddow = brushShaddow; this.text = text; this.font = font; IsVisible = true; }
void Awake () { if (Instance) { Destroy(gameObject); return; } Instance = this; }
void Start() { SFServer = SmartFoxConnection.Connection; this.PlayerRB = this.GetComponent<Rigidbody>(); crosshairTransform = Camera.main.transform.parent; this.MecAnim = this.GetComponentInChildren<Animator>(); this.ourLPC = this.GetComponentInParent<LocalPlayerController>(); theUI = (GameUI)FindObjectOfType(typeof(GameUI)); }
public NodeCursorEventArgs(NodeBase source, string command, object tag, int X, int Y, int ClickCount, GameUI.MouseButtons Button, GameUI.MouseClicks ClickType) : base(source, command, tag) { this.x = X; this.y = Y; this.clicks = ClickCount; this.button = Button; this.clicktype = ClickType; }
void Awake() { monsterTr = this.gameObject.GetComponent<Transform> (); playerTr = GameObject.FindWithTag ("Player").GetComponent<Transform> (); nvAgent = this.gameObject.GetComponent<NavMeshAgent>(); animator = this.gameObject.GetComponent<Animator> (); //nvAgent.destination = playerTr.position; gameUI = GameObject.Find("GameUI").GetComponent<GameUI>(); }
public NodePuzzleWin(GameUI myGameUI, int myDepth, VectorInt pos) : base(myGameUI, myDepth) { CurrentAbsolute = pos; chain = new ActionChain(); chain.Add(new ActionCounter(0, 100, 2, ReSizeText)); chain.Init(); winner = new NodeEffectText(myGameUI, myDepth+1, "Congratz!!!", new Font("Arial", 10f), font, fontBK, pos); myGameUI.Add(winner); }
/// <summary> /// Simple Constructor. No path, Arial 12, White, Shaddow. No path. /// </summary> /// <param name="myGameUI">GameUI</param> /// <param name="myDepth">Depth Z-order</param> /// <param name="Text">Display Message</param> /// <param name="Start">StartPosition</param> public NodeEffectText(GameUI myGameUI, int myDepth, string Text, VectorInt Start) : base(myGameUI, myDepth) { CurrentAbsolute = Start; text = Text; font = new Font("Arial", 12, FontStyle.Bold); brush = new SolidBrush(Color.White); brushShaddow = new SolidBrush(Color.FromArgb(80,80,80)); Path = null; IsVisible = true; UpdateSize(); }
/// <summary> /// Simple Constructor. No path, Arial 12, White, Shaddow. No path. /// </summary> /// <param name="myGameUI">GameUI</param> /// <param name="myDepth">Depth Z-order</param> /// <param name="Text">Display Message</param> /// <param name="Start">StartPosition</param> public NodeEffectText(GameUI myGameUI, int myDepth, string Text, VectorInt Start) : base(myGameUI, myDepth) { CurrentAbsolute = Start; text = Text; font = myGameUI.ResourceFactory[ResourceID.GameMiscFontDefault].DataAsFont; brush = myGameUI.ResourceFactory[ResourceID.GameMiscFontDefaultBrush].DataAsBrush; brushShaddow = myGameUI.ResourceFactory[ResourceID.GameMiscFontDefaultBrushShaddow].DataAsBrush; Path = null; IsVisible = true; UpdateSize(); }
/// <summary> /// Simple Constructor. Display a random message /// Linear Path (diagonal), Arial 12, Yellow, Shaddow. /// </summary> /// <param name="myGameUI">GameUI</param> /// <param name="myDepth">Depth Z-order</param> /// <param name="Text">Display Message</param> /// <param name="Start">StartPosition</param> public NodeEffectText(GameUI myGameUI, int myDepth, string[] Text, VectorInt Start) : base(myGameUI, myDepth) { CurrentAbsolute = Start; font = new Font("Arial", 12, FontStyle.Bold); brush = new SolidBrush(Color.Yellow); brushShaddow = new SolidBrush(Color.FromArgb(80, 80, 80)); Path = new Linear(CurrentAbsolute, new VectorInt(20, 20), new VectorDouble(1, 1), false); text = RandomHelper.Select<string>(Text); IsVisible = true; UpdateSize(); }
/// <summary> /// Simple Constructor. Display a random message /// Linear Path (diagonal), Arial 12, Yellow, Shaddow. /// </summary> /// <param name="myGameUI">GameUI</param> /// <param name="myDepth">Depth Z-order</param> /// <param name="Text">Display Message</param> /// <param name="Start">StartPosition</param> public NodeEffectText(GameUI myGameUI, int myDepth, string[] Text, VectorInt Start) : base(myGameUI, myDepth) { CurrentAbsolute = Start; font = myGameUI.ResourceFactory[ResourceID.GameMiscFontDefault].DataAsFont; brush = myGameUI.ResourceFactory[ResourceID.GameMiscFontDefaultBrush].DataAsBrush; brushShaddow = myGameUI.ResourceFactory[ResourceID.GameMiscFontDefaultBrushShaddow].DataAsBrush; Path = new Linear(CurrentAbsolute, new VectorInt(20, 20), new VectorDouble(1, 1), false); text = RandomHelper.Select<string>(Text); IsVisible = true; UpdateSize(); }
public NodeUIDialogHelp(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth) { Text = @"Place all crates/gem on the goal positions. You can push but never pull crates, you can only push one crate at a time. Use the arrow keys to move. [U] for Undo, [R] for Restart. [ESC] to exit. Click on a floor to move there. Drag a crate to a new position."; TextTitle = "Sokoban Help"; CurrentAbsolute = GameUI.GameCoords.PuzzleRegion.Center.Subtract(100, 100); Size = new SizeInt(500, 200); }
public NodeControllerBookmarks(GameUI myGameUI, int myDepth) : base(myGameUI, myDepth) { VectorInt vi = myGameUI.GameCoords.PositionWayPoints.TopLeft; b1 = new NodeUIButton(myGameUI, myDepth + 1, vi, "$Graphics/Tiles/Clean/WayPointButton1.png", "WP1"); b1.ImageBack = null; b1.ToolTip = "Bookmark #1"; b1.OnClick += new EventHandler<NotificationEvent>(OnButtonClick); b1.OnMouseOver += new EventHandler<NotificationEvent>(OnButtonMouseOver); myGameUI.Add(b1); vi = vi.Add(0, 40); b2 = new NodeUIButton(myGameUI, myDepth +2, vi, "$Graphics/Tiles/Clean/WayPointButton2.png", "WP2"); b2.ImageBack = null; b2.ToolTip = "Bookmark #2"; b2.OnClick += new EventHandler<NotificationEvent>(OnButtonClick); b2.OnMouseOver += new EventHandler<NotificationEvent>(OnButtonMouseOver); myGameUI.Add(b2); vi = vi.Add(0, 40); b3 = new NodeUIButton(myGameUI, myDepth + 3, vi, "$Graphics/Tiles/Clean/WayPointButton3.png", "WP3"); b3.ImageBack = null; b3.ToolTip = "Bookmark #3"; b3.OnClick += new EventHandler<NotificationEvent>(OnButtonClick); b3.OnMouseOver += new EventHandler<NotificationEvent>(OnButtonMouseOver); myGameUI.Add(b3); vi = vi.Add(0, 40); b4 = new NodeUIButton(myGameUI, myDepth + 4, vi, "$Graphics/Tiles/Clean/WayPointButton4.png", "WP4"); b4.ImageBack = null; b4.ToolTip = "Bookmark #4"; b4.OnClick += new EventHandler<NotificationEvent>(OnButtonClick); b4.OnMouseOver += new EventHandler<NotificationEvent>(OnButtonMouseOver); myGameUI.Add(b4); vi = vi.Add(0, 40); b5 = new NodeUIButton(myGameUI, myDepth + 5, vi, "$Graphics/Tiles/Clean/WayPointButton5.png", "WP5"); b5.ImageBack = null; b5.ToolTip = "Bookmark #5"; b5.OnClick += new EventHandler<NotificationEvent>(OnButtonClick); b5.OnMouseOver += new EventHandler<NotificationEvent>(OnButtonMouseOver); myGameUI.Add(b5); brushBookmarkOn = null; brushBookmarkOff = new SolidBrush(Color.FromArgb(120, Color.Black)); staticImageRender = new StaticImage(ResourceFactory.Singleton.GetInstance("Default.Tiles"), new VectorInt(16, 16)); }
/// <summary> /// Strong Construction /// </summary> /// <param name="myGameUI"></param> /// <param name="myDepth"></param> /// <param name="PositionAbs"></param> /// <param name="resImage">Resource of the UI button image</param> /// <param name="ClickCommand">Command string passed back in the click event</param> public NodeUIButton(GameUI myGameUI, int myDepth, VectorInt PositionAbs, ResourceID resImage, string ClickCommand) : base(myGameUI, myDepth) { imageNormal = myGameUI.ResourceFactory[resImage].DataAsImage; imageBack = myGameUI.ResourceFactory[ResourceID.GameButtonBackGround].DataAsImage; Size = new SizeInt(imageBack.Size); CurrentAbsolute = PositionAbs; clickCommand = ClickCommand; mouseOverBrush = myGameUI.ResourceFactory[ResourceID.GameButtonMouseOverBrush].DataAsBrush; maskEffect = null; toolTip = null; if (GameUI.Cursor != null) { GameUI.Cursor.OnClick += new EventHandler<NodeCursorEventArgs>(cursor_OnClick); } }
/// <summary> /// Strong Construction /// </summary> /// <param name="myGameUI"></param> /// <param name="myDepth"></param> /// <param name="PositionAbs"></param> /// <param name="FileImage">Filename</param> /// <param name="ClickCommand">Command string passed back in the click event</param> public NodeUIButton(GameUI myGameUI, int myDepth, VectorInt PositionAbs, string FileImage, string ClickCommand) : base(myGameUI, myDepth) { imageNormal = new Bitmap(FileManager.getContent(FileImage)); imageBack = new Bitmap(FileManager.getContent("$Graphics\\Icons\\BasicButtonBK.png")); Size = new SizeInt(imageBack.Size); CurrentAbsolute = PositionAbs; clickCommand = ClickCommand; mouseOverBrush = new SolidBrush(Color.FromArgb(60, Color.Yellow)); maskEffect = null; toolTip = null; if (GameUI.Cursor != null) { GameUI.Cursor.OnClick += new EventHandler<NodeCursorEventArgs>(cursor_OnClick); } }
public void setGameTimerUI(GameUI gameUI) { _gameUI = gameUI; }
public static async Task <bool> CleanTask() { try { if (!ZetaDia.IsInGame) { return(false); } if (ZetaDia.IsLoadingWorld) { return(false); } if (!ZetaDia.Me.IsFullyValid()) { return(false); } if (ZetaDia.Me.IsParticipatingInTieredLootRun) { Logger.LogNormal("Cannot clean stash while in trial/greater rift"); RemoveBehavior("Cannot clean stash while in trial/greater rift"); return(false); } if (TrinityItemManager.FindValidBackpackLocation(true) == new Vector2(-1, -1)) { Trinity.ForceVendorRunASAP = true; return(false); } if (!await TrinityCoroutines.Common.ReturnToStashTask()) { _isFinished = true; return(false); } if (GameUI.IsElementVisible(GameUI.StashDialogMainPage)) { Logger.Log("Cleaning stash..."); foreach (var item in ZetaDia.Me.Inventory.StashItems.Where(i => i.ACDGuid != 0 && i.IsValid).ToList()) { CachedACDItem cItem = CachedACDItem.GetCachedItem(item); // Don't take potions from the stash if (cItem.TrinityItemType == TrinityItemType.HealthPotion) { continue; } try { if (!ItemManager.Current.ShouldStashItem(item)) { Logger.Log("Removing {0} from stash", item.Name); ZetaDia.Me.Inventory.QuickWithdraw(item); await Coroutine.Sleep(ItemMovementDelay); await Coroutine.Yield(); if (TrinityItemManager.FindValidBackpackLocation(true) == new Vector2(-1, -1)) { Trinity.ForceVendorRunASAP = true; return(false); } } } catch (Exception ex) { Logger.LogError(ex.ToString()); } } _isFinished = true; Trinity.ForceVendorRunASAP = true; Logger.Log("Waiting 5 seconds..."); BotMain.StatusText = "Waiting 5 seconds..."; await Coroutine.Sleep(5000); if (TrinityCoroutines.Common.StartedOutOfTown && ZetaDia.IsInTown) { await CommonBehaviors.TakeTownPortalBack().ExecuteCoroutine(); } } if (_isFinished) { RemoveBehavior("finished!"); } return(true); } catch (Exception ex) { _isFinished = true; Logger.LogError(ex.ToString()); return(false); } }
private void Start() { ui = GameObject.FindGameObjectWithTag("Game UI").GetComponent <GameUI>(); camTransform = transform; cam = Camera.main; }
private void Awake() { Instance = this; GameUI = GetComponent <GameUI>(); }
public CellIndicator(Cells cells, GameUI ui) { this.cells = cells; this.ui = ui; }
private async Task <bool> UpgradeGemsTask(bool force = false) { if (VendorDialog.IsVisible && (GameUI.IsElementVisible(UpgradeGemButton) && UpgradeGemButton.IsEnabled) || GameUI.IsElementVisible(UpgradeButton)) { bool hasUpgradeableGems = ZetaDia.Actors.GetActorsOfType <ACDItem>() .Where(item => item.ItemType == ItemType.LegendaryGem).Any(item => GetUpgradeChance(item) > 0.00f); if (!hasUpgradeableGems) { Logger.Error("No valid gems found to upgrade! Leaving game..."); await CommonCoroutines.UseTownPortal("Unable to upgrade gem - leaving game"); await Coroutine.Sleep(100); await Coroutine.Yield(); await CommonCoroutines.LeaveGame("Unable to upgrade gem"); _isDone = true; await Coroutine.Sleep(100); await Coroutine.Yield(); return(true); } float minimumGemChance = force ? 0f : QuestToolsSettings.Instance.MinimumGemChance; List <ACDItem> gems = ZetaDia.Actors.GetActorsOfType <ACDItem>() .Where(item => item.ItemType == ItemType.LegendaryGem && GetUpgradeChance(item) > 0.00f && GetUpgradeChance(item) >= minimumGemChance) .OrderByDescending(item => GetUpgradeChance(item)) .ThenByDescending(item => item.JewelRank).ToList(); if (gems.Count == 0 && !_isGemsOnly) //No gems that can be upgraded - upgrade keystone { return(false); } if (gems.Count == 0 && _isGemsOnly) { gems = ZetaDia.Actors.GetActorsOfType <ACDItem>() .Where(item => item.ItemType == ItemType.LegendaryGem) .Where(item => !IsMaxLevelGem(item) && GetUpgradeChance(item) > 0.00f) .OrderByDescending(item => GetUpgradeChance(item)) .ThenByDescending(item => item.JewelRank).ToList(); } _isGemsOnly = true; int selectedGemId = int.MaxValue; string selectedGemPreference = ""; foreach (string gemName in QuestToolsSettings.Instance.GemPriority) { selectedGemId = DataDictionary.LegendaryGems.FirstOrDefault(kv => kv.Value == gemName).Key; // Map to known gem type or dynamic priority if (selectedGemId == int.MaxValue) { Logger.Error("Invalid Gem Name: {0}", gemName); continue; } // Equipped Gems if (selectedGemId == 0) { selectedGemPreference = gemName; if (gems.Any(IsGemEquipped)) { gems = gems.Where(item => item.InventorySlot == InventorySlot.Socket).ToList(); break; } } // Lowest Rank if (selectedGemId == 1) { selectedGemPreference = gemName; gems = gems.OrderBy(item => item.JewelRank).ToList(); break; } // Highest Rank if (selectedGemId == 2) { selectedGemPreference = gemName; gems = gems.OrderByDescending(item => item.JewelRank).ToList(); break; } // Selected gem if (gems.Any(i => i.ActorSNO == selectedGemId)) { selectedGemPreference = gemName; if (gems.Any(i => i.ActorSNO == selectedGemId)) { gems = gems.Where(i => i.ActorSNO == selectedGemId).Take(1).ToList(); break; } } // No gem found... skip! } if (selectedGemId < 10) { Logger.Log("Using gem priority of {0}", selectedGemPreference); } var bestGem = gems.FirstOrDefault(); if (bestGem != null && await CommonCoroutines.AttemptUpgradeGem(bestGem)) { await Coroutine.Sleep(250); GameUI.SafeClickElement(VendorCloseButton, "Vendor Window Close Button"); await Coroutine.Yield(); return(true); } else { /* * Demonbuddy MAY randomly fail to upgrade the selected gem. This is a workaround, in case we get stuck... */ var randomGems = ZetaDia.Actors.GetActorsOfType <ACDItem>() .Where(item => item.ItemType == ItemType.LegendaryGem) .OrderBy(item => item.JewelRank).ToList(); Random random = new Random(DateTime.UtcNow.Millisecond); int i = random.Next(0, randomGems.Count - 1); var randomGem = randomGems.ElementAtOrDefault(i); if (randomGem == null) { Logger.Error("Error: No gems found"); return(false); } Logger.Error("Gem Upgrade failed! Upgrading random Gem {0} ({1}) - {2:##.##}% {3} ", randomGem.Name, randomGem.JewelRank, GetUpgradeChance(randomGem) * 100, IsGemEquipped(randomGem) ? "Equipped" : string.Empty); if (!await CommonCoroutines.AttemptUpgradeGem(randomGem)) { Logger.Error("Random gem upgrade also failed. Something... seriously... wrong... "); } return(true); } } return(false); }
void Awake() { Instance = this; canvasGroup = GetComponent <CanvasGroup>(); }
void Awake() { instance = this; }
private void Awake() { instance = this; }
void Awake() { em = GameObject.Find("EnemyManager").GetComponent <EnemyManager>(); gu = GameObject.Find("Canvas").GetComponent <GameUI>(); currentTime = startingTime; }
public void Init(int pId, bool pIsLocal, NetworkMessanger pNetworkMessanger, PlaygroundField playgroundField, GameUI pUi) { Id = pId; IsLocal = pIsLocal; networkMessanger = pNetworkMessanger; bodyParts = new List <BodyPart>(); for (int i = 0; i < bodyPartsCount; i++) { AddBodyPart(100 - i * 10); } PlaceAt(playgroundField); itemController = new ItemController(this, pUi.ItemPanel, pUi.ActionPanel); powerUpController = new PowerUpController(this, pUi.PowerUpPanel, pUi.ActionPanel); }
void Awake() { // set the instance to this script instance = this; }
void Update() { // cheats (only usable during development) #if UNITY_EDITOR if (Input.GetKeyUp(KeyCode.E)) { if (SceneManager.GetActiveScene().name != "Menu") { AddPoint(); UpdatePoint(); } } else if (Input.GetKeyUp(KeyCode.Alpha8)) { wave += 1; } else if (Input.GetKeyUp(KeyCode.W) && bazookaLevel < 3) { BuyBazooka(); } else if (Input.GetKeyUp(KeyCode.T) && lives < 9) { if (SceneManager.GetActiveScene().name != "Survival" && SceneManager.GetActiveScene().name != "Survival") { On1UPBought(); } } else if (Input.GetKeyUp(KeyCode.Y)) { if (coinMultiplier < 10) { coinMultiplier += 1; } } else if (Input.GetKeyUp(KeyCode.Comma)) { Debug.Log(coinMultiplier); } else if (Input.GetKeyUp(KeyCode.Space)) { if (SceneManager.GetActiveScene().name == "Menu") { SceneManager.LoadScene("Survival"); } } #endif if (Input.GetKeyUp(KeyCode.R)) { Reset(); } /* Disabled scripts #1: Forgot what these functions are for * if (SceneManager.GetActiveScene().name == "Menu") * sceneChangeScan = true; * * if (sceneChangeScan) * SceneManager.sceneLoaded += OnLevelFinishedLoading; * else * SceneManager.sceneLoaded -= OnLevelFinishedLoading; */ if (SceneManager.GetActiveScene().name == "Menu") { if (menuAudioManager == null) { menuAudioManager = GameObject.Find("Menu Audio Manager").GetComponent <AudioSource> (); } if (menuUI == null) { menuUI = GameObject.Find("EventSystem").GetComponent <MenuUI> (); } if (enemySpawning) { enemySpawning = false; } if (isWaveBreak) { isWaveBreak = false; } } else { if (inventory == null) { inventory = GameObject.Find("Panel Weapon Select").GetComponent <Inventory> (); } if (pauser == null) { pauser = GameObject.Find("EventSystem").GetComponent <Pauser> (); } if (SceneManager.GetActiveScene().name == "Survival") { spawner = GameObject.Find("Spawner").GetComponent <Spawner> (); gameUI = GameObject.Find("EventSystem").GetComponent <GameUI> (); // temp scripts to prevent shieldLevel from going less than 0 if (shieldLevel < 0) { shieldLevel = 0; } if (!dead) { if (gun == null) { gun = GameObject.Find("Gun").GetComponent <Gun> (); gun.ChangeWeapon(equippedBazookaInGunScript); } } if ((!isWaveBreak && spawner.limitReached && spawner.enemiesOnScene.Length <= 0) || !isWaveBreak && wave == 0) { WaveBreak(); } } } }
private async Task <bool> InteractRoutine() { if (Player.IsValid && Actor != null && Actor.IsValid) { if (TargetIsDungeonStone && (GameUI.IsElementVisible(GameUI.GenericOK) || GameUI.IsElementVisible(UIElements.ConfirmationDialogOkButton))) { GameUI.SafeClickElement(GameUI.GenericOK, "Generic OK"); await Coroutine.Yield(); GameUI.SafeClickElement(UIElements.ConfirmationDialogOkButton); await Coroutine.Yield(); await Coroutine.Sleep(3000); return(true); } if (_startingWorldId <= 0) { _startingWorldId = ZetaDia.CurrentWorldId; } _interactWaitMilliSeconds = TargetIsDungeonStone ? 4000 : 250; LogInteraction(); if (IsPortal) { GameEvents.FireWorldTransferStart(); } if (IsChanneling) { await Coroutine.Wait(TimeSpan.FromSeconds(3), () => IsChanneling); } switch (Actor.ActorType) { case ActorType.Gizmo: switch (Actor.ActorInfo.GizmoType) { case GizmoType.BossPortal: case GizmoType.Portal: case GizmoType.ReturnPortal: ZetaDia.Me.UsePower(SNOPower.GizmoOperatePortalWithAnimation, Actor.Position); break; default: ZetaDia.Me.UsePower(SNOPower.Axe_Operate_Gizmo, Actor.Position); break; } break; case ActorType.Monster: ZetaDia.Me.UsePower(SNOPower.Axe_Operate_NPC, Actor.Position); break; } // Doubly-make sure we interact Actor.Interact(); GameUI.SafeClickElement(GameUI.GenericOK, "Generic OK"); GameUI.SafeClickElement(UIElements.ConfirmationDialogOkButton, "Confirmation Dialog OK Button"); if (_startInteractPosition == Vector3.Zero) { _startInteractPosition = ZetaDia.Me.Position; } _lastPosition = ZetaDia.Me.Position; _completedInteractions++; _lastInteract = DateTime.UtcNow; if (TargetIsDungeonStone || IsPortal) { await Coroutine.Sleep(250); } return(true); } return(false); }
internal void Tick() { try { foreach (var ped in World.GetAllPeds()) { if (ped == null) { continue; } if (ped.Exists() && ped.HasBeenDamagedBy(Game.Player.Character) && ped.IsDead && !killedPeds.IsDuplicate(ped)) { killedPeds.Add(ped); logger.Debug("Pedestrian down by player"); Game.MaxWantedLevel = 0; Game.Player.IgnoredByPolice = true; if (Game.Player.Character.Position.DistanceTo(ped.Position) <= 2.5f) { Common.Earn(new Random().Next(4, 16)); } Common.Kills++; if (weaponedPeds.IsDuplicate(ped)) { Common.Earn(50); GameUI.DisplayHelp(Strings.ArmedBonus); if (ped.AttachedBlip?.Exists() == true) { ped.AttachedBlip?.Delete(); } } switch (Common.Kills) { case 1: GameUI.DisplayHelp(Strings.FirstKill); break; case 100: Common.CurrentDifficulty = Difficulty.Easy; GameUI.DisplayHelp(string.Format(Strings.DifficultyHelp, Strings.DifficultyEasy)); GameController.SetRelationship(Difficulty.Easy); break; case 300: Common.CurrentDifficulty = Difficulty.Normal; GameUI.DisplayHelp(string.Format(Strings.DifficultyHelp, Strings.DifficultyNormal)); GameController.SetRelationship(Difficulty.Normal); break; case 700: Common.CurrentDifficulty = Difficulty.Hard; GameUI.DisplayHelp(string.Format(Strings.DifficultyHelp, Strings.DifficultyHard)); GameController.SetRelationship(Difficulty.Hard); break; case 1500: Common.CurrentDifficulty = Difficulty.Nether; GameUI.DisplayHelp(string.Format(Strings.DifficultyHelp, Strings.DifficultyNether)); GameController.SetRelationship(Difficulty.Nether); break; } } if (peds1.IsDuplicate(ped) || !ped.IsHuman) { continue; } peds1.Add(ped); Functions.TriggerPed(this, ped); } if (killedPeds.Count >= 6000) { killedPeds.Clear(); } if (weaponedPeds.Count >= 600) { weaponedPeds.Clear(); } if (peds1.Count >= 60000) { peds1.Clear(); } Functions.TriggerTick(this); } catch (Exception ex) { GameUI.DisplayHelp(Strings.ExceptionMain); logger.Fatal(ex); throw; } }
private async Task <bool> MainCoroutine() { if (ZetaDia.Me == null) { return(false); } if (!ZetaDia.IsInGame) { return(false); } if (ZetaDia.IsLoadingWorld) { await Coroutine.Sleep(50); return(false); } if (!ZetaDia.Me.IsValid) { return(false); } if (ZetaDia.Me.IsDead) { return(false); } if (DateTime.UtcNow.Subtract(_lastInteract).TotalMilliseconds < 500 && WorldHasChanged()) { return(true); } if (Timeout > 0 && DateTime.UtcNow.Subtract(_tagStartTime).TotalSeconds > Timeout) { End("Timeout of {0} seconds exceeded for Profile Behavior {1}", Timeout, Status()); return(true); } if (TargetIsDungeonStone && GameUI.IsElementVisible(GameUI.GenericOK)) { GameUI.SafeClickElement(GameUI.GenericOK, "Generic OK"); await Coroutine.Yield(); await Coroutine.Sleep(3000); } GameUI.SafeClickUIButtons(); if (Vector3.Distance(_lastPosition, ZetaDia.Me.Position) > 5f) { _lastPositionUpdate = DateTime.UtcNow; _lastPosition = ZetaDia.Me.Position; } if (ExitWithVendorWindow && GameUI.IsElementVisible(UIElements.VendorWindow)) { EndDebug("Vendor window is visible " + Status()); } if (Actor == null && Position == Vector3.Zero && !WorldHasChanged()) { var lastSeenPosition = ActorHistory.GetActorPosition(ActorId); if (lastSeenPosition != Vector3.Zero) { Warn("Can't find actor! using last known position {0} Distance={1}", lastSeenPosition.ToString(), lastSeenPosition.Distance(ZetaDia.Me.Position)); Position = lastSeenPosition; return(true); } EndDebug("ERROR: Could not find an actor or position to move to, finished! {0}", Status()); return(true); } if (IsPortal && WorldHasChanged()) { if (DestinationWorldId > 0 && ZetaDia.CurrentWorldId != DestinationWorldId && ZetaDia.CurrentWorldId != _startingWorldId) { EndDebug("Error! We used a portal intending to go from WorldId={0} to WorldId={1} but ended up in WorldId={2} {3}", _startingWorldId, DestinationWorldId, ZetaDia.CurrentWorldId, Status()); return(true); } await Coroutine.Sleep(100); EndDebug("Successfully used portal {0} to WorldId {1} {2}", ActorId, ZetaDia.CurrentWorldId, Status()); return(true); } if (Actor == null && ((MaxSearchDistance > 0 && WithinMaxSearchDistance()) || WithinInteractRange())) { EndDebug("Finished: Actor {0} not found, within InteractRange {1} and MaxSearchDistance {2} of Position {3} {4}", ActorId, InteractRange, MaxSearchDistance, Position, Status()); return(true); } if (Position.Distance(ZetaDia.Me.Position) > 1500) { EndDebug("ERROR: Position distance is {0} - this is too far! {1}", Position.Distance(ZetaDia.Me.Position), Status()); return(true); } if (_moveResult == MoveResult.ReachedDestination && Actor == null) { EndDebug("Reached Destination, no actor found! " + Status()); return(true); } if (Actor == null) { if (MaxSearchDistance > 0 && !WithinMaxSearchDistance()) { Move(Position); return(true); } if (InteractRange > 0 && !WithinInteractRange()) { Move(Position); return(true); } } if (Actor == null || !Actor.IsValid) { return(true); } if (((!IsPortal && _completedInteractions >= InteractAttempts && InteractAttempts > 0) || (IsPortal && WorldHasChanged()) || AnimationMatch())) { EndDebug("Successfully interacted with Actor {0} at Position {1} " + Status(), Actor.ActorSNO, Actor.Position); return(true); } if (InteractAttempts <= 0 && WithinInteractRange()) { EndDebug("Actor is within interact range {0:0} - no interact attempts " + Status(), Actor.Distance); return(true); } if (_completedInteractions >= InteractAttempts) { EndDebug("Interaction failed after {0} interact attempts " + Status(), _completedInteractions); return(true); } if (ExitWithConversation && GameUI.IsElementVisible(GameUI.TalktoInteractButton1)) { GameUI.SafeClickElement(GameUI.TalktoInteractButton1, "Conversation Interaction Button 1"); EndDebug("Clicked Conversation Interaction Button 1 " + Status()); return(true); } if (!WithinInteractRange()) { Move(Actor.Position); return(true); } await Coroutine.Wait(_interactWaitMilliSeconds, ShouldWaitForInteraction); if ((WithinInteractRange() || DateTime.UtcNow.Subtract(_lastPositionUpdate).TotalMilliseconds > 750) && _completedInteractions < InteractAttempts) { return(await InteractRoutine()); } Logger.Debug("No action taken"); return(true); }
public void SetUIReference(GameUI g) { ui = g; }
public DebugScreen(GameUI parent) : base(parent) { }
public static void Init(GameUI ui) { _ui = ui; InitFleetRecord(); InitTeamRecord(); }
public void ResetUI() { ui = FindObjectOfType <GameUI> (); }
public GameUI() { GameUI.instance = this; }
void Awake() { I = this; }
public static async Task <bool> Execute() { try { if (!ZetaDia.IsInGame) { return(false); } if (await ClearArea.Execute()) { Core.Logger.Debug("Clearing"); return(false); } CheckForDBVendoringBug(); if (DateTime.UtcNow < DontAttemptTownRunUntil) { IsVendoring = false; return(false); } // Fix for Campaign quest start of ACT1 if (ZetaDia.CurrentQuest.QuestSnoId == 87700) { return(false); } if (Core.CastStatus.StoneOfRecall.LastResult == CastResult.Casting) { Core.Logger.Verbose(LogCategory.GlobalHandler, "Casting"); return(true); } if (!ShouldStartTownRun()) { IsVendoring = false; return(false); } IsWantingTownRun = true; Core.Logger.Debug("Town run started"); if (ZetaDia.Globals.IsLoadingWorld) { return(true); } if (!ZetaDia.IsInTown) { if (ZetaDia.Me.IsInCombat && !ClearArea.IsClearing && ZetaDia.Actors.GetActorsOfType <DiaUnit>().Any(u => u?.CommonData != null && u.CommonData.IsValid && u.IsAlive && u.IsHostile && u.Distance < 16f)) { ClearArea.Start(); } await GoToTown(); if (!ZetaDia.IsInTown) { if (Core.CastStatus.StoneOfRecall.LastResult == CastResult.Failed) { Core.Logger.Debug("Setting Town Run Cooldown because of cast failure"); DontAttemptTownRunUntil = DateTime.UtcNow.AddSeconds(5); } return(true); } } Core.Logger.Verbose($"Starting Townrun"); IsInTownVendoring = true; while (DateTime.UtcNow.Subtract(ChangeEvents.WorldId.LastChanged).TotalMilliseconds < 2000 || ZetaDia.Globals.IsLoadingWorld || ZetaDia.Globals.WorldSnoId <= 0) { await Coroutine.Sleep(2000); } await Coroutine.Wait(8000, () => Core.Actors.Inventory.Any()); await Coroutine.Sleep(1000); Core.Logger.Debug("Started Town Run Loop"); var checkCycles = 2; while (!Core.Player.IsInventoryLockedForGreaterRift) { Core.Inventory.Backpack.ForEach(i => Core.Logger.Debug($"Backpack Item: {i.Name} ({i.ActorSnoId} / {i.InternalName}) RawItemType={i.RawItemType} TrinityItemType={i.TrinityItemType}")); await Coroutine.Yield(); GameUI.CloseVendorWindow(); await IdentifyItems.Execute(); if (!ZetaDia.IsInGame) { StartedOutOfTown = false; IsWantingTownRun = false; IsInTownVendoring = false; IsVendoring = false; return(false); } if (!await ExtractLegendaryPowers.Execute()) { continue; } if (!await Gamble.Execute()) { continue; } if (!await CubeRaresToLegendary.Execute()) { continue; } if (!await CubeItemsToMaterials.Execute()) { continue; } if (await Any( DropItems.Execute, () => StashItems.Execute(true), SellItems.Execute, SalvageItems.Execute)) { continue; } checkCycles--; if (checkCycles == 0) { break; } } await StashItems.Execute(); await RepairItems.Execute(); Core.Logger.Log("Finished Town Run woo!"); DontAttemptTownRunUntil = DateTime.UtcNow + TimeSpan.FromSeconds(15); if (StartedOutOfTown) { StartedOutOfTown = false; await TakeReturnPortal(); } IsWantingTownRun = false; } finally { IsInTownVendoring = false; IsVendoring = false; } return(false); }