public void OnClick() { if (BuildingManager.ActiveBuilding.State == BuildingState.MOVING) { // Moving if (BuildingModeGrid.GetInstance().CanObjectBePlacedAtPosition(BuildingManager.ActiveBuilding, BuildingManager.ActiveBuilding.MovePosition)) { if (BuildingManager.GetInstance().MoveBuilding()) { UIGamePanel.ShowPanel(PanelType.DEFAULT); } } } else { // Placing if (BuildingModeGrid.GetInstance().CanObjectBePlacedAtPosition(BuildingManager.ActiveBuilding, BuildingManager.ActiveBuilding.Position)) { if (BuildingManager.GetInstance().PlaceBuilding()) { UIGamePanel.ShowPanel(PanelType.DEFAULT); } } } }
virtual public void Show() { content.SetActive(true); if (IsModal) //??? { activePanel = this; } }
public void OnClick() { if (BuildingManager.ActiveBuilding != null && canDismiss) { BuildingManager.ActiveBuilding.DismissOccupant(occupant); UIGamePanel.ShowPanel(PanelType.VIEW_OCCUPANTS); } }
/** * Button clicked, start activity. */ override public void OnClick() { if (ResourceManager.Instance.Resources > myBuilding.Type.cost) { myBuilding.StartActivity(ActivityType.CLEAR, System.DateTime.Now, ""); UIGamePanel.ShowPanel(PanelType.DEFAULT); } }
public static void CloseActivePanel() { if (!activePanel) { return; } activePanel.Hide(); activePanel = null; }
public void OnBetPanelClose(ModelPanelCloseResult res) { UIAuctionPanel panel = UIGamePanel.GetPanel <UIAuctionPanel>(PanelType.AUCTION_PANEL); if (res == ModelPanelCloseResult.OK) { Sh.Out.Send("make bet " + panel.CurrentBet + "; god: <" + panel.GodName + ">"); } }
public void OnCardClick(int cardSlot) { UIBuyCardPanel panel = UIGamePanel.GetPanel <UIBuyCardPanel>(PanelType.BUY_CARD_PANEL); panel.Card = Cyclades.Game.Constants.cardChimera; panel.SetPrice(5 - cardSlot); UIGamePanel.ShowPanel(PanelType.BUY_CARD_PANEL); }
/** * Start the generic activity function. */ public void DoActivity(string type, string supportingId) { if (BuildingManager.ActiveBuilding.StartActivity(type, System.DateTime.Now, supportingId)) { UIGamePanel.ShowPanel(PanelType.DEFAULT); } else { Debug.LogWarning("This is where you pop up your IAP screen"); } }
public void OnConreteAuctionGodClick(int number) { UIAuctionPanel panel = UIGamePanel.GetPanel <UIAuctionPanel>(PanelType.AUCTION_PANEL); panel.MinBet = 0; panel.MaxBet = 10; panel.GodName = Cyclades.Game.Constants.godMars; panel.CurrentBet = number; UIGamePanel.ShowPanel(PanelType.AUCTION_PANEL, this); }
public static void ShowPanel(PanelType panelType, UIGamePanel parentPanel) { if (activePanel && activePanel.IsModal) { return; } UIGamePanel.parentPanel = parentPanel; if (panels.ContainsKey(panelType)) { panels [panelType].Show(); } }
public void OnClick() { if (ResourceManager.Instance.CanBuild(BuildingManager.GetInstance().GetBuildingTypeData(buildingTypeId))) { BuildingManager.GetInstance().CreateBuilding(buildingTypeId); UIGamePanel.ShowPanel(PanelType.PLACE_BUILDING); } else { Debug.LogWarning("This is where you bring up your in app purchase screen"); } }
public void OnClick() { if (isGold) { BuildingManager.GetInstance().SellBuildingForGold(BuildingManager.ActiveBuilding); } else { BuildingManager.GetInstance().SellBuilding(BuildingManager.ActiveBuilding, false); } UIGamePanel.ShowPanel(PanelType.DEFAULT); BuildingManager.ActiveBuilding = null; }
/** * Update the labels as time passes. */ protected IEnumerator UpdateLabels() { while (BuildingManager.ActiveBuilding != null && BuildingManager.ActiveBuilding.CurrentActivity != null && BuildingManager.ActiveBuilding.CurrentActivity.RemainingTime.TotalSeconds > 0) { timeLabel.text = string.Format("Time Remaining: {0} minutes {1} second{2}", (int)BuildingManager.ActiveBuilding.CurrentActivity.RemainingTime.TotalMinutes, BuildingManager.ActiveBuilding.CurrentActivity.RemainingTime.Seconds, (BuildingManager.ActiveBuilding.CurrentActivity.RemainingTime.Seconds != 1 ? "s" : "")); goldLabel.text = ((int)Mathf.Max(1, (float)(BuildingManager.ActiveBuilding.CurrentActivity.RemainingTime.TotalSeconds + 1) / (float)BuildingManager.GOLD_TO_SECONDS_RATIO)).ToString(); yield return(true); } // If we get to here we finished... hide this panel. if (BuildingManager.ActiveBuilding != null && BuildingManager.ActiveBuilding.CurrentActivity != null) { UIGamePanel.ShowPanel(PanelType.DEFAULT); } }
public void OnClick() { List <Activity> activities = ActivityManager.GetInstance().GetActivitiesOfDataClassType(typeof(AttackActivityData)); if (activities == null || activities.Count == 0) { UIGamePanel.ShowPanel(PanelType.TARGET_SELECT); } else { // This button only handles one activity if (activities[0].PercentageComplete >= 1) { ActivityManager.GetInstance().AcknowledgeActivity(activities[0]); } } }
public void OnClick() { if (building.State == BuildingState.READY) { BuildingManager.GetInstance().AcknowledgeBuilding(building); } else if (building.State == BuildingState.IN_PROGRESS || building.CurrentActivity != null) { UIGamePanel.ShowPanel(PanelType.SPEED_UP); if (UIGamePanel.activePanel is UISpeedUpPanel) { ((UISpeedUpPanel)UIGamePanel.activePanel).InitialiseWithBuilding(building); } } else { building.AcknowledgeActivity(); } }
public void OnClick() { if (BuildingManager.ActiveBuilding != null) { // Moving if (BuildingManager.ActiveBuilding.State == BuildingState.MOVING) { BuildingManager.ActiveBuilding.ResetPosition(); BuildingManager.ActiveBuilding.FinishMoving(); UIGamePanel.ShowPanel(PanelType.DEFAULT); } else { // Placing if (BuildingManager.GetInstance().SellBuilding(BuildingManager.ActiveBuilding, true)) { UIGamePanel.ShowPanel(PanelType.DEFAULT); } } } }
public void OnClick() { if (building.Type.isObstacle) { if (building.CurrentActivity == null && building.CompletedActivity == null) { UIGamePanel.ShowPanel(PanelType.OBSTACLE_INFO); if (UIGamePanel.activePanel is UIBuildingInfoPanel) { ((UIBuildingInfoPanel)UIGamePanel.activePanel).InitialiseWithBuilding(building); } } } else if (building.State == BuildingState.BUILT) { UIGamePanel.ShowPanel(PanelType.BUILDING_INFO); if (UIGamePanel.activePanel is UIBuildingInfoPanel) { ((UIBuildingInfoPanel)UIGamePanel.activePanel).InitialiseWithBuilding(building); } } }
public void OnClick() { UIGamePanel.ShowPanel(PanelType.SELL_BUILDING); ((UISellBuildingPanel)UIGamePanel.activePanel).InitialiseWithBuilding(BuildingManager.ActiveBuilding); }
/** * Handle the battle results calculations */ public void CustomReward(Activity activity) { List <string> losses = new List <string>(); int goldRewarded = 0; int resourcesRewarded = 0; ActivityData type = ActivityManager.GetInstance().GetActivityData(activity.Type); if (type is AttackActivityData) { int troopStrength = 0; foreach (string s in activity.SupportingIds) { OccupantData o = OccupantManager.GetInstance().GetOccupant(s); if (o != null && o.Type is AttackerOccupantTypeData) { troopStrength += ((AttackerOccupantTypeData)o.Type).attack; } } // Calculate result bool winner = false; if (troopStrength >= ((AttackActivityData)type).strength * 2) { winner = true; // No losses } else if (troopStrength >= ((AttackActivityData)type).strength) { if (Random.Range(0, 3) != 0) { winner = true; } // 25% chance of losing each unit losses.AddRange(activity.SupportingIds.Where(o => Random.Range(0, 4) == 0).ToList()); // Ensure at least one troop member survives if (losses.Count == activity.SupportingIds.Count) { losses.RemoveAt(0); } } else if (troopStrength >= (int)(((AttackActivityData)type).strength * 0.5f)) { // Calculate losses if (Random.Range(0, 3) == 0) { winner = true; } // 50% chance of losing each unit losses.AddRange(activity.SupportingIds.Where(o => Random.Range(0, 2) == 0).ToList()); // Ensure at least one troop member survives if (losses.Count == activity.SupportingIds.Count) { losses.RemoveAt(0); } } else { // Lose everyone losses.AddRange(activity.SupportingIds); } // Calculate reward if (winner) { goldRewarded = Random.Range(0, type.rewardAmount + 1); resourcesRewarded = Random.Range(1, type.rewardAmount + 1) * 100; } // Remove occupants string lossesString = ""; foreach (string o in losses) { lossesString += OccupantManager.GetInstance().GetOccupant(o).Type.name + ", "; } foreach (string o in losses) { OccupantManager.GetInstance().DismissOccupant(o); } if (lossesString.Length > 0) { lossesString.Substring(0, lossesString.Length - 2); } // Add rewards ResourceManager.Instance.AddResources(resourcesRewarded); ResourceManager.Instance.AddGold(goldRewarded); // Show panel - UIBattleResultsPanel panel = (UIBattleResultsPanel)FindObjectOfType(typeof(UIBattleResultsPanel)); if (panel != null) { panel.InitialiseWithResults(winner, lossesString, goldRewarded, resourcesRewarded); UIGamePanel.ShowPanel(PanelType.BATTLE_RESULTS); } } }
public void OnPressOKButton() { UIGamePanel.CloseActivePanel("OnBetPanelClose", ModelPanelCloseResult.OK); }
public void OnPressCancelButton() { UIGamePanel.CloseActivePanel("OnBetPanelClose", ModelPanelCloseResult.CANCEL); }
private void GetGamePanel() => _uiGamePanel = GameObject.FindGameObjectWithTag("GamePanel").GetComponent <UIGamePanel>();
public void OnClick() { BuildingManager.GetInstance().SpeedUp(); UIGamePanel.ShowPanel(PanelType.DEFAULT); }
public void OnClick() { UIGamePanel.ShowPanel(PanelType.RECRUIT_OCCUPANTS); // if (UIGamePanel.activePanel is UIOccupantSelect) ((UIOccupantSelect)UIGamePanel.activePanel).InitialiseWithBuilding(BuildingManager.ActiveBuilding); }
/** * Start the generic activty function. */ public void DoActivity(string type, string supportingId) { building.StartActivity(type, System.DateTime.Now, supportingId); UIGamePanel.ShowPanel(PanelType.DEFAULT); }
public void OnClick() { UIGamePanel.ShowPanel(type); }
public void OnPressOKButton() { Sh.Out.Send("buy card"); UIGamePanel.CloseActivePanel(); }
public void OnPressCancelButton() { UIGamePanel.CloseActivePanel(); }
public void OnClick() { BuildingManager.ActiveBuilding.StartMoving(); UIGamePanel.ShowPanel(PanelType.PLACE_BUILDING); }
public void OnClick() { ActivityManager.GetInstance().StartActivity(activity, System.DateTime.Now, OccupantManager.GetInstance().GetAllOccupants().Select(o => o.uid).ToList()); UIGamePanel.ShowPanel(PanelType.DEFAULT); }