private bool Have(Upgrade upgrade) { foreach(UpgradeInfo u in GetComponentsInChildren<UpgradeInfo>()) if(u.upgrade.upgradeName == upgrade.upgradeName) return true; return false; }
public void DeActivateStation () { SetPlayerStats(); if(selectedUpgrade != null) ChangeSelectedButton(Color.white); buyButton.gameObject.SetActive(false); SetImageAndText (); DisableBuyScreen(); selectedUpgrade = null; }
public static UpgradeInfo Generate(Upgrade u,Transform parent = null) { GameObject obj = Instantiate<GameObject>(Resources.Load<GameObject>("IconValue2")); UpgradeInfo instance = obj.AddComponent<UpgradeInfo>(); instance.upgrade = u; instance.transform.SetParent(parent); return instance; }
public void Slot(Upgrade upgradeSlotting) { // Debug.Log(upgradeSlotting); title.text = upgradeSlotting.title; description.text = upgradeSlotting.description; gemCost.text = "" + upgradeSlotting.gemCost; optionSlotted = upgradeSlotting; }
public void AddUpgradeToList(Upgrade upgradeToAdd) { GameObject newUpgrade = Instantiate(upgradeTemplate) as GameObject; newUpgrade.tag = "Upgrade"; newUpgrade.name = upgradeToAdd.name; newUpgrade.GetComponentInChildren<Text>().text = upgradeToAdd.name; newUpgrade.transform.SetParent(upgradeScrollList); newUpgrade.GetComponent<Button>().onClick.AddListener(() => GetComponent<PurchaseController>().Purchase(newUpgrade)); }
public void upgrade(Player_Board.e_color newColor) { if (newColor != Player_Board.e_color.NONE) color = newColor; else ++level; if (script == null) script = GameObject.Find("Board").GetComponent<Upgrade>(); setNewStats(script.getNewStats(type, color, level)); }
// Use this for initialization public void Initialize(Upgrade upgrade) { this.upgrade = upgrade; if (upgrade != null) { titleText.text = upgrade.name.ToUpper(); } UpdateState(); }
public void SelectUpgrade (Upgrade upgrade) { if (selectedUpgrade != null) { ChangeSelectedButton(Color.white); } if (!buyButton.gameObject.activeInHierarchy) { buyButton.gameObject.SetActive( true); } selectedUpgrade = upgrade; ChangeSelectedButton(Color.red); SetImageAndText (selectedUpgrade); CheckUpgrade(); }
Upgrade UpgradeBuilder(XmlElement node) { // Create upgrade structure Upgrade tempUpgrade = new Upgrade(); tempUpgrade.name = node["name"].InnerText; tempUpgrade.upgradeAmount = float.Parse(node["upgradeAmount"].InnerText); tempUpgrade.upgradeTarget = node["upgradeTarget"].InnerText; tempUpgrade.moneyCost = int.Parse(node["moneyCost"].InnerText); tempUpgrade.researchNeeded = int.Parse(node["researchNeeded"].InnerText); tempUpgrade.explorationNeeded = int.Parse(node["explorationNeeded"].InnerText); // Add upgrade to GUI GetComponent<GUIController>().AddUpgradeToList(tempUpgrade); return tempUpgrade; }
public static Upgrade refreshOrAdd(string name, string prefName, int cost, int costIncr, int max, int curr, Text costText, Text currText) { Upgrade upgrade; upgradeMap.TryGetValue(name, out upgrade); if(upgrade == null) { //If we didn't get it out of the dictionary, add a new one. upgrade = new Upgrade(prefName, cost, costIncr, max, curr, costText, currText); upgradeMap.Add(name, upgrade); } else { //Gotta update these because they are new objects when the MainMenu is reloaded. upgrade.costText = costText; upgrade.currText = currText; } return upgrade; }
private static void MakeUpgrades() { upgrades = new Dictionary<string, Upgrade[]>(); //Range Stat[] stats = { new Stat(Attribute.Range, 1f) }; Upgrade[] tempUpgrades = new Upgrade[] { new Upgrade ("Range", "A good range.", 30, stats), new Upgrade ("Raange", "A better range!", 45, stats), new Upgrade ("Raaange", "A tremendous range!!!1!", 60, stats) }; upgrades.Add("Range", tempUpgrades); //Damage stats = new Stat[] { new Stat(Attribute.Damage, 1f) }; tempUpgrades = new Upgrade[] { new Upgrade ("Damage", "A good damage.", 30, stats), new Upgrade ("Daamage", "A better damage!", 45, stats), new Upgrade ("Daaamage", "A tremendous damage!!!1!", 60, stats) }; upgrades.Add("Damage", tempUpgrades); //Speed stats = new Stat[] { new Stat(Attribute.RateOfFire, 1f) }; tempUpgrades = new Upgrade[] { new Upgrade ("Speed", "A good speed.", 30, stats), new Upgrade ("Speeed", "A better speed!", 45, stats), new Upgrade ("Speeeed", "A tremendous speed!!!1!", 60, stats) }; upgrades.Add("Speed", tempUpgrades); }
public void AddUpgrade(GameObject tile, int enhancement) { int type; //Perform a lookup switch(enhancement) { case (int)TileType.enhancement.PLANT: type = UpgradeHelper.PlantLookup (manager.tileFromObject [tile].type); if(type != -1) { Upgrade newUpgrade = new Upgrade(manager.tileFromObject [tile],plantFunctions[type],enhancement,type); SetFlair(manager.getFlair[tile],Resource.plantMeshes[type],Resource.plantMaterials[type]); manager.tileUpgrades.Add(newUpgrade); manager.tileFromObject [tile].upgrade = newUpgrade; } break; case (int)TileType.enhancement.ANIMAL: type = UpgradeHelper.PlantLookup (manager.tileFromObject [tile].type); if(type != -1) { Upgrade newUpgrade = new Upgrade(manager.tileFromObject [tile],animalFunctions[type],enhancement,type); SetFlair(manager.getFlair[tile],Resource.animalMeshes[type],Resource.animalMaterials[type]); manager.tileUpgrades.Add(newUpgrade); manager.tileFromObject [tile].upgrade = newUpgrade; } break; case (int)TileType.enhancement.MINERAL: type = UpgradeHelper.PlantLookup (manager.tileFromObject [tile].type); if(type != -1) { Upgrade newUpgrade = new Upgrade(manager.tileFromObject [tile],mineralFunctions[type],enhancement,type); SetFlair(manager.getFlair[tile],Resource.mineralMeshes[type],Resource.mineralMaterials[type]); manager.tileUpgrades.Add(newUpgrade); manager.tileFromObject [tile].upgrade = newUpgrade; } break; case -1: Debug.Log("Nothing goes here"); break; } }
public void BuildTree(GameObject currItem, GameObject newMenu, Upgrade currNode) { if (currNode.leftNode != null) { GameObject newMenuItem = BuildItem (currNode.leftNode); newMenuItem.transform.SetParent (currItem.transform); newMenuItem.transform.localPosition = leftSpacing; //buildBranch(0, currItem, currNode.leftNode.unlocked); BuildTree(newMenuItem, newMenu, currNode.leftNode); } if (currNode.midNode != null) { GameObject newMenuItem = BuildItem (currNode.midNode); newMenuItem.transform.SetParent (currItem.transform); newMenuItem.transform.localPosition = midSpacing; //buildBranch(1, currItem, currNode.midNode.unlocked); BuildTree(newMenuItem, newMenu, currNode.midNode); } if (currNode.rightNode != null) { GameObject newMenuItem = BuildItem (currNode.rightNode); newMenuItem.transform.SetParent (currItem.transform); newMenuItem.transform.localPosition = rightSpacing; //buildBranch(2, currItem, currNode.rightNode.unlocked); BuildTree(newMenuItem, newMenu, currNode.rightNode); } }
//set components of the tower passed in for later use and access public void SetTowerComponents(GameObject tower) { upgrade = tower.GetComponent<Upgrade>(); towerBase = tower.GetComponent<TowerBase>(); }
// Update is called once per frame void Update() { currentUpgradeTime += Time.deltaTime; currentSpawnTime += Time.deltaTime; if (currentUpgradeTime > actualUpgradeTime) { if (!spawnedUpgrade) // 1 // 2 { int randomNumber = Random.Range(0, spawnPoints.Length - 1); GameObject spawnLocation = spawnPoints[randomNumber]; // 3 GameObject upgrade = Instantiate(upgradePrefab) as GameObject; Upgrade upgradeScript = upgrade.GetComponent <Upgrade>(); upgradeScript.gun = gun; upgrade.transform.position = spawnLocation.transform.position; // 4 spawnedUpgrade = true; SoundManager.Instance.PlayOneShot(SoundManager.Instance.powerUpAppear); } } if (currentSpawnTime > generatedSpawnTime) { currentSpawnTime = 0; generatedSpawnTime = Random.Range(minSpawnTime, maxSpawnTime); if (aliensPerSpawn > 0 && aliensOnScreen < totalAliens) { List <int> previousSpawnLocations = new List <int>(); if (aliensPerSpawn > spawnPoints.Length) { aliensPerSpawn = spawnPoints.Length - 1; } aliensPerSpawn = (aliensPerSpawn > totalAliens) ? aliensPerSpawn - totalAliens : aliensPerSpawn; for (int i = 0; i < aliensPerSpawn; i++) { if (aliensOnScreen < maxAliensOnScreen) { aliensOnScreen += 1; // 1 int spawnPoint = -1; // 2 while (spawnPoint == -1) { // 3 int randomNumber = Random.Range(0, spawnPoints.Length - 1); // 4 if (!previousSpawnLocations.Contains(randomNumber)) { previousSpawnLocations.Add(randomNumber); spawnPoint = randomNumber; } } GameObject spawnLocation = spawnPoints[spawnPoint]; GameObject newAlien = Instantiate(alien) as GameObject; newAlien.transform.position = spawnLocation.transform.position; Alien alienScript = newAlien.GetComponent <Alien>(); alienScript.target = player.transform; Vector3 targetRotation = new Vector3(player.transform.position.x, newAlien.transform.position.y, player.transform.position.z); newAlien.transform.LookAt(targetRotation); } } } } }
/// <summary>Called when a module is upgraded.</summary> /// <param name="version">The version.</param> /// <returns>Success if all goes well, otherwise, Failed</returns> public string UpgradeModule(string version) { try { switch (version) { case "07.04.00": const string ResourceFile = ModuleFolder + "/App_LocalResources/ProviderConfiguration.ascx.resx"; string pageName = Localization.GetString("HTMLEditorPageName", ResourceFile); string pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile); // Create HTML Editor Config Page (or get existing one) TabInfo editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", false); // Find the RadEditor control and remove it Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false); // Add Module To Page int moduleDefId = this.GetModuleDefinitionID("DotNetNuke.HtmlEditorManager", "Html Editor Management"); Upgrade.AddModuleToPage(editorPage, moduleDefId, pageName, ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true); foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger)) { DesktopModuleInfo moduleInfo = item.Value; if (moduleInfo.ModuleName == "DotNetNuke.HtmlEditorManager") { moduleInfo.Category = "Host"; DesktopModuleController.SaveDesktopModule(moduleInfo, false, false); } } break; case "09.01.01": if (RadEditorProviderInstalled()) { UpdateRadCfgFiles(); } if (TelerikAssemblyExists()) { UpdateWebConfigFile(); } break; case "09.02.00": if (TelerikAssemblyExists()) { UpdateTelerikEncryptionKey("Telerik.Web.UI.DialogParametersEncryptionKey"); } break; case "09.02.01": if (TelerikAssemblyExists()) { UpdateTelerikEncryptionKey("Telerik.Upload.ConfigurationHashKey"); } break; } } catch (Exception ex) { var xlc = new ExceptionLogController(); xlc.AddLog(ex); return("Failed"); } return("Success"); }
public bool IsValid() => Upgrade.AreValid() && Rollback.AreValid() && Downgrade.AreValid();
public GameObject BuildItem(Upgrade upgrade) { GameObject newMenuItem = (GameObject)Instantiate (upgradeItem); Image itemBg = newMenuItem.transform.GetChild (0).gameObject.GetComponent<Image> (); Image itemIcon = newMenuItem.transform.GetChild (1).gameObject.GetComponent<Image> (); Button buttons = newMenuItem.GetComponentInChildren<Button>(); buttons.onClick.AddListener(() => ConfirmPopup(upgrade, newMenuItem)); itemIcon.sprite = upgrade.icon; Destroy (newMenuItem.GetComponent<Image> ()); if (upgrade.unlocked) { itemBg.sprite = Resources.Load<Sprite>("Menu Elements/unlockedIcon"); Destroy(newMenuItem.transform.GetChild(2).gameObject); } return newMenuItem; }
public ActionResult <Upgrade> Create([FromBody] Upgrade upgrade) { _upgradesService.Create(upgrade); return(CreatedAtRoute("GetUpgrade", new { id = upgrade.Id.ToString() }, upgrade)); }
private void UpgradeApplication() { //Start Timer Upgrade.StartTimer(); //Write out Header HtmlUtils.WriteHeader(Response, "upgrade"); Response.Write("<h2>Current Assembly Version: " + Globals.glbAppVersion + "</h2>"); Response.Flush(); // get path to script files string providerPath = PortalSettings.GetProviderPath(); if (!providerPath.StartsWith("ERROR:")) { // get current database version IDataReader dr = PortalSettings.GetDatabaseVersion(); if (dr.Read()) { //Call Upgrade with the current DB Version to upgrade an //existing DNN installation int majVersion = Convert.ToInt32(dr["Major"]); int minVersion = Convert.ToInt32(dr["Minor"]); int buildVersion = Convert.ToInt32(dr["Build"]); string strDatabaseVersion = String.Format(majVersion.ToString(), "00") + "." + String.Format(minVersion.ToString(), "00") + "." + String.Format(buildVersion.ToString(), "00"); Response.Write("<h2>Current Database Version: " + strDatabaseVersion + "</h2>"); Response.Flush(); string ignoreWarning = Null.NullString; string strWarning = Null.NullString; if ((majVersion == 3 && minVersion < 3) || (majVersion == 4 && minVersion < 3)) { //Users and profile have not been transferred // Get the name of the data provider ProviderConfiguration providerConfiguration = ProviderConfiguration.GetProviderConfiguration("data"); //Execute Special Script Upgrade.ExecuteScript(providerPath + "Upgrade." + providerConfiguration.DefaultProvider); if ((Request.QueryString["ignoreWarning"] != null)) { ignoreWarning = Request.QueryString["ignoreWarning"].ToLower(); } strWarning = Upgrade.CheckUpgrade(); } else { ignoreWarning = "true"; } //Check whether Upgrade is ok if (strWarning == Null.NullString || ignoreWarning == "true") { Response.Write("<br><br>"); Response.Write("<h2>Upgrade Status Report</h2>"); Response.Flush(); Upgrade.UpgradeDNN(providerPath, strDatabaseVersion.Replace(".", "")); //Install Resources ResourceInstaller objResourceInstaller = new ResourceInstaller(); objResourceInstaller.Install(true, 0); Response.Write("<h2>Upgrade Complete</h2>"); Response.Write("<br><br><h2><a href='../Default.aspx'>Click Here To Access Your Portal</a></h2><br><br>"); } else { Response.Write("<h2>Warning:</h2>" + strWarning.Replace("\r\n", "<br />")); Response.Write("<br><br><a href='Install.aspx?mode=Install&ignoreWarning=true'>Click Here To Proceed With The Upgrade.</a>"); } Response.Flush(); } dr.Close(); } else { Response.Write("<h2>Upgrade Error: " + providerPath + "</h2>"); Response.Flush(); } //Write out Footer HtmlUtils.WriteFooter(Response); }
void setNewStats(Upgrade.TurretInfos turretInfos) { damage = turretInfos.damage; Debug.Log("Damage setNewStats " + damage); cost = turretInfos.cost; if (color == Player_Board.e_color.BLUE) slowDuration += 1; else if (color == Player_Board.e_color.GREEN) poisonPower += 1; }
public UpgradeLevel(Upgrade u, int l) { Upgrade = u; Level = l; }
private void InstallApplication() { // the application uses a two step installation process. The first step is used to update // the Web.config with any configuration settings - which forces an application restart. // The second step finishes the installation process and provisions the site. string installationDate = Config.GetSetting("InstallationDate"); string backupFolder = Globals.glbConfigFolder + "Backup_" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + "\\"; if (installationDate == null || installationDate == "") { XmlDocument xmlConfig = new XmlDocument(); string strError = ""; //save the current config files try { if (!Directory.Exists(Globals.ApplicationMapPath + backupFolder)) { Directory.CreateDirectory(Globals.ApplicationMapPath + backupFolder); } if (File.Exists(Globals.ApplicationMapPath + "\\web.config")) { File.Copy(Globals.ApplicationMapPath + "\\web.config", Globals.ApplicationMapPath + backupFolder + "web_old.config", true); } } catch (Exception) { //Error backing up old web.config //This error is not critical, so can be ignored } try { // open the web.config xmlConfig = Config.Load(); // create random keys for the Membership machine keys xmlConfig = Config.UpdateMachineKey(xmlConfig); } catch (Exception ex) { strError += ex.Message; } // save a copy of the web.config strError += Config.Save(xmlConfig, backupFolder + "web_.config"); // save the web.config strError += Config.Save(xmlConfig); if (strError == "") { // send a new request to the application to initiate step 2 Response.Redirect(HttpContext.Current.Request.RawUrl, true); } else { // error saving web.config StreamReader reader = File.OpenText(HttpContext.Current.Server.MapPath("~/403-3.htm")); string strHTML = reader.ReadToEnd(); reader.Close(); strHTML = strHTML.Replace("[MESSAGE]", strError); HttpContext.Current.Response.Write(strHTML); HttpContext.Current.Response.End(); } } else { //Start Timer Upgrade.StartTimer(); //Write out Header HtmlUtils.WriteHeader(Response, "install"); // get path to script files string providerPath = PortalSettings.GetProviderPath(); if (!providerPath.StartsWith("ERROR:")) { Response.Write("<h2>Version: " + Globals.glbAppVersion + "</h2>"); Response.Flush(); Response.Write("<br><br>"); Response.Write("<h2>Installation Status Report</h2>"); Response.Flush(); Upgrade.InstallDNN(providerPath); Response.Write("<h2>Installation Complete</h2>"); Response.Write("<br><br><h2><a href='../Default.aspx'>Click Here To Access Your Portal</a></h2><br><br>"); Response.Flush(); } else { // upgrade error Response.Write("<h2>Upgrade Error: " + providerPath + "</h2>"); Response.Flush(); } //Write out Footer HtmlUtils.WriteFooter(Response); //log APPLICATION_START event Global.LogStart(); //Start Scheduler Global.StartScheduler(); } }
public void AddUpgrade(Upgrade upgrade) { ownedUpgrades.Add(upgrade); }
void OnUpgradePressed() { Upgrade?.Invoke(); }
public Upgrades(Upgrade manaUpgrade, Upgrade mageUpgrade, Upgrade emperorUpgrade) { this.ManaUpgrade = manaUpgrade; this.MageUpgrade = mageUpgrade; this.EmperorUpgrade = emperorUpgrade; }
void CheckPlayerPrefsForUpgrade(Upgrade upgrade) { upgrade.Level = PlayerPrefs.GetInt (upgrade.ToString (), 0); }
/// <summary> /// User has requested an upgrade. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnUpgrade(object sender, EventArgs e) { if (listView1.SelectedIndices.Count == 1) { try { if (!checkBox1.Checked) { throw new Exception("You must agree to the license terms before upgrading."); } if (firstNameBox.Text == null || lastNameBox.Text == null || emailBox.Text == null || countryBox.Text == null) { throw new Exception("The mandatory details at the bottom of the screen (denoted with an asterisk) must be completed."); } Upgrade upgrade = upgrades[listView1.SelectedIndices[0]]; string versionNumber = upgrade.ReleaseDate.ToString("yyyy.MM.dd.") + upgrade.issueNumber; if (MessageBox.Show("Are you sure you want to upgrade to version " + versionNumber + "?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; WebClient web = new WebClient(); string tempSetupFileName = Path.Combine(Path.GetTempPath(), "APSIMSetup.exe"); if (File.Exists(tempSetupFileName)) { File.Delete(tempSetupFileName); } try { web.DownloadFile(upgrade.ReleaseURL, tempSetupFileName); } catch (Exception err) { MessageBox.Show("Cannot download this release. Error message is: \r\n" + err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Write to the registration database. WriteUpgradeRegistration(versionNumber); if (File.Exists(tempSetupFileName)) { // Copy the separate upgrader executable to the temp directory. string sourceUpgraderFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Updater.exe"); string upgraderFileName = Path.Combine(Path.GetTempPath(), "Updater.exe"); // Delete the old upgrader. if (File.Exists(upgraderFileName)) { File.Delete(upgraderFileName); } // Copy in the new upgrader. File.Copy(sourceUpgraderFileName, upgraderFileName, true); // Run the upgrader. string binDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string ourDirectory = Path.GetFullPath(Path.Combine(binDirectory, "..")); string newDirectory = Path.GetFullPath(Path.Combine(ourDirectory, "..", "APSIM" + versionNumber)); string arguments = StringUtilities.DQuote(ourDirectory) + " " + StringUtilities.DQuote(newDirectory); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = upgraderFileName; info.Arguments = arguments; info.WorkingDirectory = Path.GetTempPath(); Process.Start(info); Cursor.Current = Cursors.Default; // Shutdown the user interface Close(); tabbedExplorerView.Close(); } } } catch (Exception err) { Cursor.Current = Cursors.Default; MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//TODO: set color on button based on "equipped" private void SetUpgradeButton(GameObject gameObject, Upgrade u) { //TODO : if you haven't discovered it, set name and description to ??? gameObject.transform.FindChild("Name").GetComponent<Text>().text = u.Name; gameObject.transform.FindChild("Description").GetComponent<Text>().text = u.Description; }
// Update is called once per frame void Update() { if (player == null) { return; } //accumulates the time between each frame currentSpawnTime += Time.deltaTime; if (currentSpawnTime > generatedSpawnTime) { currentSpawnTime = 0; generatedSpawnTime = Random.Range(minSpawnTime, maxSpawnTime); if (aliensPerSpawn > 0 && aliensOnScreen < totalAliens) { List <int> previousSpawnLocations = new List <int>(); if (aliensPerSpawn > spawnPoints.Length) { aliensPerSpawn = spawnPoints.Length - 1; } aliensPerSpawn = (aliensPerSpawn > totalAliens) ? aliensPerSpawn - totalAliens : aliensPerSpawn; for (int i = 0; i < aliensPerSpawn; i++) { if (aliensOnScreen < maxAliensOnScreen) { aliensOnScreen += 1; int spawnPoint = -1; while (spawnPoint == -1) { int randomNumber = Random.Range(0, spawnPoints.Length - 1); if (!previousSpawnLocations.Contains(randomNumber)) { previousSpawnLocations.Add(randomNumber); spawnPoint = randomNumber; } } GameObject spawnLocation = spawnPoints[spawnPoint]; GameObject newAlien = Instantiate(alien) as GameObject; newAlien.transform.position = spawnLocation.transform.position; Alien alienScript = newAlien.GetComponent <Alien>(); alienScript.target = player.transform; Vector3 targetRotation = new Vector3(player.transform.position.x, newAlien.transform.position.y, player.transform.position.z); newAlien.transform.LookAt(targetRotation); alienScript.OnDestroy.AddListener(AlienDestroyed); alienScript.GetDeathParticles().SetDeathFloor(deathFloor); } } } } currentUpgradeTime += Time.deltaTime; if (currentUpgradeTime > actualUpgradeTime) { if (!spawnedUpgrade) { int randomNumber = Random.Range(0, spawnPoints.Length - 1); GameObject spawnLocation = spawnPoints[randomNumber]; GameObject upgrade = Instantiate(upgradePrefab) as GameObject; Upgrade upgradeScript = upgrade.GetComponent <Upgrade>(); upgradeScript.gun = gun; upgrade.transform.position = spawnLocation.transform.position; spawnedUpgrade = true; SoundManager.Instance.PlayOneShot(SoundManager.Instance.powerUpAppear); } } }
public void On() { OnOff = true; Upgrade?.Invoke("Техника включена"); }
public void Deserialize(Stream input, Endian endian) { var basePosition = input.Position; var rawUpgradeRoot = RawUpgradeRoot.Read(input, endian); var upgrades = new Upgrade[rawUpgradeRoot.UpgradeCount]; if (rawUpgradeRoot.UpgradeCount != 0) { if (rawUpgradeRoot.UpgradeCount < 0 || rawUpgradeRoot.UpgradeCount > int.MaxValue) { throw new FormatException(); } var rawUpgrades = new RawUpgrade[rawUpgradeRoot.UpgradeCount]; input.Position = basePosition + rawUpgradeRoot.UpgradeOffset; for (long i = 0; i < rawUpgradeRoot.UpgradeCount; i++) { rawUpgrades[i] = RawUpgrade.Read(input, endian); } for (long i = 0; i < rawUpgradeRoot.UpgradeCount; i++) { var rawUpgrade = rawUpgrades[i]; var upgrade = new Upgrade() { Name = rawUpgrade.Name, TaskGroup = rawUpgrade.TaskGroup, StarThreshold = rawUpgrade.StarThreshold, Prerequisites = new uint[rawUpgrade.PrerequisiteCount], Cost = rawUpgrade.Cost, Ability = rawUpgrade.Ability, UIName = rawUpgrade.UIName, UIDescription = rawUpgrade.UIDescription, UIDisplayOrder = rawUpgrade.UIDisplayOrder, UIImage = rawUpgrade.UIImage, UITreeName = rawUpgrade.UITreeName, UITreeOrder = rawUpgrade.UITreeOrder, }; if (rawUpgrade.PrerequisiteCount != 0) { if (rawUpgrade.PrerequisiteCount < 0 || rawUpgrade.PrerequisiteCount > int.MaxValue) { throw new FormatException(); } input.Position = basePosition + rawUpgrade.PrerequisiteOffset; for (long j = 0; j < rawUpgrade.PrerequisiteCount; j++) { upgrade.Prerequisites[j] = input.ReadValueU32(endian); } } if (rawUpgrade.UIVideoOffset != 0) { input.Position = basePosition + rawUpgrade.UIVideoOffset; upgrade.UIVideo = input.ReadStringZ(Encoding.ASCII); } upgrades[i] = upgrade; } } this._Upgrades.Clear(); this._Upgrades.AddRange(upgrades); }
public void TryToUnlock(Upgrade upgrade, GameObject currItem) { if (GameMgmt.status.UnlockPoints > 0 && upgrade.unlocked == false && (upgrade.root == null || upgrade.root.unlocked == true)) { Debug.Log ("Unlocked " + upgrade.upgradeName); if (upgrade.upgradeType == Upgrade.UpgradeType.Modifier) { calculateModifiers(upgrade); } upgrade.unlocked = true; upgrade.levelRequired = 1; GameMgmt.status.UnlockPoints--; GetComponent<AudioSource>().PlayOneShot(Resources.Load<AudioClip>("Audio/pika yes")); Destroy (currMenu); OpenUpgradeTree (); } else if (GameMgmt.status.UnlockPoints == 0) { GetComponent<AudioSource>().PlayOneShot(Resources.Load<AudioClip>("Audio/pika no")); player.CreateMessage ("No Unlock Points", true); } else if (upgrade.root != null && upgrade.root.unlocked == false) { GetComponent<AudioSource>().PlayOneShot(Resources.Load<AudioClip>("Audio/pika no")); player.CreateMessage ("Requires prior upgrade", true); } else { GetComponent<AudioSource>().PlayOneShot(Resources.Load<AudioClip>("Audio/pika no")); player.CreateMessage ("You Already Unlocked This", true); } }
/// <summary>执行更新</summary> /// <param name="ur"></param> /// <returns></returns> public Boolean ProcessUpgrade(UpgradeInfo ur) { XTrace.WriteLine("执行更新:{0} {1}", ur.Version, ur.Source); var dest = "."; var url = ur.Source; try { // 需要下载更新包 if (!url.IsNullOrEmpty()) { var fileName = Path.GetFileName(url); if (!fileName.EndsWithIgnoreCase(".zip")) { fileName = Rand.NextString(8) + ".zip"; } fileName = "Update".CombinePath(fileName).EnsureDirectory(true); // 清理 //NewLife.Net.Upgrade.DeleteBuckup(dest); var ug = new Upgrade { Log = XTrace.Log }; ug.DeleteBackup(dest); // 下载 var sw = Stopwatch.StartNew(); var client = new HttpClient(); client.DownloadFileAsync(url, fileName).Wait(); sw.Stop(); XTrace.WriteLine("下载 {0} 到 {1} 完成,耗时 {2} 。", url, fileName, sw.Elapsed); // 解压 var source = fileName.TrimEnd(".zip"); if (Directory.Exists(source)) { Directory.Delete(source, true); } source.EnsureDirectory(false); fileName.AsFile().Extract(source, true); // 更新覆盖之前,再次清理exe/dll/pdb foreach (var item in dest.AsDirectory().GetAllFiles("*.exe;*.dll;*.pdb", true)) { WriteLog("Delete {0}", item); try { item.Delete(); } catch { var del = item.FullName + $".{Rand.Next(100000, 999999)}.del"; item.MoveTo(del); } } // 覆盖 ug.CopyAndReplace(source, dest); if (Directory.Exists(source)) { Directory.Delete(source, true); } } // 升级处理命令,可选 var cmd = ur.Executor?.Trim(); if (!cmd.IsNullOrEmpty()) { XTrace.WriteLine("执行更新命令:{0}", cmd); var si = new ProcessStartInfo { UseShellExecute = true, }; var p = cmd.IndexOf(' '); if (p < 0) { si.FileName = cmd; } else { si.FileName = cmd.Substring(0, p); si.Arguments = cmd.Substring(p + 1); } Process.Start(si); } return(true); } catch (Exception ex) { XTrace.WriteLine("更新失败!"); XTrace.WriteException(ex); return(false); } }
static public float costScaling = .5f; // costs of upgrades increase by 50% with each upgrade public static void MakeUpgrades() { upgrades = new Dictionary <string, Upgrade[]>(); //Quake Stat[] stats = { new Stat(Attribute.Range, -1f), new Stat(Attribute.RateOfFire, 1f), new Stat(Attribute.Slow, .1f), new Stat(Attribute.SlowDuration, 1f) }; Upgrade[] tempUpgrades = new Upgrade[] { new Upgrade("Quake", "A tremendous earth quake that slows enemies!", 30, stats), new Upgrade("Quake", "A tremendous earth quake that slows enemies!", 45, stats), new Upgrade("Quake", "A tremendous earth quake that slows enemies!", 60, stats) }; upgrades.Add("Quake", tempUpgrades); //Meteor Shower tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.Range, -1f), new Stat(Attribute.RateOfFire, -1f), new Stat(Attribute.AoeDamage, 1f) }; tempUpgrades[0] = new Upgrade("Meteor Shower", "Meteors that cause splash damage to near by enemies!", 20, stats); stats = new Stat[] { new Stat(Attribute.AoeDamage, 1f) }; tempUpgrades[1] = new Upgrade("Meteor Shower", "Meteors that cause splash damage to near by enemies!", 30, stats); stats = new Stat[] { new Stat(Attribute.Range, -1f), new Stat(Attribute.AoeDamage, 2f), new Stat(Attribute.AoeRange, 1f) }; tempUpgrades[2] = new Upgrade("Meteor Shower", "Meteors that cause splash damage to near by enemies!", 40, stats); upgrades.Add("Meteor Shower", tempUpgrades); //Root Binding tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.RateOfFire, -1f), new Stat(Attribute.Slow, .8f), new Stat(Attribute.SlowDuration, 1f) }; tempUpgrades[0] = new Upgrade("Root Binding", "Entangle enemies in roots to severly slow them down!", 30, stats); stats = new Stat[] { new Stat(Attribute.RateOfFire, -1f), new Stat(Attribute.Slow, .1f), new Stat(Attribute.SlowDuration, 1f) }; tempUpgrades[1] = new Upgrade("Root Binding", "Entangle enemies in roots to severly slow them down!", 45, stats); stats = new Stat[] { new Stat(Attribute.Slow, .1f), new Stat(Attribute.SlowDuration, 1f) }; tempUpgrades[2] = new Upgrade("Root Binding", "Entangle enemies in roots to severly slow them down!", 60, stats); upgrades.Add("Root Binding", tempUpgrades); //Inferno tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.RateOfFire, 1f), new Stat(Attribute.Damage, -1f) }; tempUpgrades[0] = new Upgrade("Inferno", "Devistate enemies with rapidly fired fireballs!", 40, stats); stats = new Stat[] { new Stat(Attribute.RateOfFire, 1f) }; tempUpgrades[1] = new Upgrade("Inferno", "Devistate enemies with rapidly fired fireballs!", 60, stats); stats = new Stat[] { new Stat(Attribute.RateOfFire, 1f) }; tempUpgrades[2] = new Upgrade("Inferno", "Devistate enemies with rapidly fired fireballs!", 80, stats); upgrades.Add("Inferno", tempUpgrades); //Armageddon tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.AoeDamage, 1f), new Stat(Attribute.AoeRange, 1f), new Stat(Attribute.RateOfFire, -2f) }; tempUpgrades[0] = new Upgrade("Armageddon", "Deal damage to multiple enemies!", 40, stats); stats = new Stat[] { new Stat(Attribute.AoeDamage, 2f), new Stat(Attribute.AoeRange, 1f), new Stat(Attribute.RateOfFire, -1f) }; tempUpgrades[1] = new Upgrade("Armageddon", "Deal damage to multiple enemies!", 60, stats); stats = new Stat[] { new Stat(Attribute.AoeDamage, 2f), new Stat(Attribute.AoeRange, 2f) }; tempUpgrades[2] = new Upgrade("Armageddon", "Deal damage to multiple enemies!", 80, stats); upgrades.Add("Armageddon", tempUpgrades); //Burn tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.DamageOverTime, 1f), new Stat(Attribute.RateOfFire, -1f) }; tempUpgrades[0] = new Upgrade("Burn", "Burn an enemy for damage over time!", 20, stats); stats = new Stat[] { new Stat(Attribute.DamageOverTime, 1f) }; tempUpgrades[1] = new Upgrade("Burn", "Burn an enemy for damage over time!", 30, stats); stats = new Stat[] { new Stat(Attribute.DamageOverTime, 2f) }; tempUpgrades[2] = new Upgrade("Burn", "Burn an enemy for damage over time!", 40, stats); upgrades.Add("Burn", tempUpgrades); //Chain Lightning tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.AoeDamage, 1f), new Stat(Attribute.AoeRange, 1f), new Stat(Attribute.RateOfFire, -1f) }; tempUpgrades[0] = new Upgrade("Chain Lightning", "Damage multiple enemies with a web of lightning!", 20, stats); stats = new Stat[] { new Stat(Attribute.AoeDamage, 2f), new Stat(Attribute.AoeRange, 1f) }; tempUpgrades[1] = new Upgrade("Chain Lightning", "Damage multiple enemies with a web of lightning!", 30, stats); stats = new Stat[] { new Stat(Attribute.AoeDamage, 2f), new Stat(Attribute.AoeRange, 1f) }; tempUpgrades[2] = new Upgrade("Chain Lightning", "Damage multiple enemies with a web of lightning!", 40, stats); upgrades.Add("Chain Lightning", tempUpgrades); //Frost tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.Slow, .1f), new Stat(Attribute.SlowDuration, 1f), new Stat(Attribute.Range, -3f) }; tempUpgrades[0] = new Upgrade("Frost", "Freeze your enemies to slow them down!", 20, stats); stats = new Stat[] { new Stat(Attribute.Slow, .1f), new Stat(Attribute.SlowDuration, 2f) }; tempUpgrades[1] = new Upgrade("Frost", "Freeze your enemies to slow them down!", 40, stats); stats = new Stat[] { new Stat(Attribute.Slow, .8f), new Stat(Attribute.SlowDuration, 1f) }; tempUpgrades[2] = new Upgrade("Frost", "Freeze your enemies to slow them down!", 50, stats); upgrades.Add("Frost", tempUpgrades); //Lightning Strike tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.Damage, 1f), new Stat(Attribute.RateOfFire, -1f) }; tempUpgrades[0] = new Upgrade("Lightning Strike", "Strike distant enemies with a bold of lightning!", 30, stats); stats = new Stat[] { new Stat(Attribute.Damage, 1f), new Stat(Attribute.Range, 2f) }; tempUpgrades[1] = new Upgrade("Lightning Strike", "Strike distant enemies with a bold of lightning!", 50, stats); stats = new Stat[] { new Stat(Attribute.Damage, 3f), new Stat(Attribute.Range, 1f) }; tempUpgrades[2] = new Upgrade("Lightning Strike", "Strike distant enemies with a bold of lightning!", 65, stats); upgrades.Add("Lightning Strike", tempUpgrades); //Poison tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.DamageOverTime, 1f), new Stat(Attribute.Range, -1f) }; tempUpgrades[0] = new Upgrade("Poison", "Slowly poison enemies!", 20, stats); stats = new Stat[] { new Stat(Attribute.Damage, 2f), new Stat(Attribute.DamageOverTime, 1f) }; tempUpgrades[1] = new Upgrade("Poison", "Slowly poison enemies!", 40, stats); stats = new Stat[] { new Stat(Attribute.DamageOverTime, 3f), }; tempUpgrades[2] = new Upgrade("Poison", "Slowly poison enemies!", 50, stats); upgrades.Add("Poison", tempUpgrades); //Mind Control tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.Damage, -1f), new Stat(Attribute.MindControlDuration, 1f) }; tempUpgrades[0] = new Upgrade("Mind Control", "Send enemies back to their spawning ground!", 40, stats); stats = new Stat[] { new Stat(Attribute.MindControlDuration, 2f), new Stat(Attribute.RateOfFire, -1f) }; tempUpgrades[1] = new Upgrade("Mind Control", "Send enemies back to their spawning ground!", 70, stats); stats = new Stat[] { new Stat(Attribute.MindControlDuration, 3f) }; tempUpgrades[2] = new Upgrade("Mind Control", "Send enemies back to their spawning ground!", 100, stats); upgrades.Add("Mind Control", tempUpgrades); //Hex tempUpgrades = new Upgrade[3]; stats = new Stat[] { new Stat(Attribute.Damage, 1f), new Stat(Attribute.Range, 1f) }; tempUpgrades[0] = new Upgrade("Hex", "Damage enemies with a powerful hex!", 20, stats); stats = new Stat[] { new Stat(Attribute.Damage, 1f), new Stat(Attribute.Range, 1f) }; tempUpgrades[1] = new Upgrade("Hex", "Damage enemies with a powerful hex!", 30, stats); stats = new Stat[] { new Stat(Attribute.Damage, 2f), new Stat(Attribute.Range, 2f) }; tempUpgrades[2] = new Upgrade("Hex", "Damage enemies with a powerful hex!", 40, stats); upgrades.Add("Hex", tempUpgrades); }
public int GetUpgradeLevels(Upgrade upgrade) { //Debug.Log((int)upgrade); return(upgradeLevels[(int)upgrade]); }
//function that checks the cost and occupied or owned , then builds houses , adds these objects to checkDrop scripts array and destroys the current dragged object void BuildHouse() { if (over && !occupied && owned && my_script.dragged != null) { if (my_script.dragged.name == "House Big(Clone)") { if (my_script.Score >= 100) { occupied = true; dragged = Instantiate(my_script.dragged, new Vector3(transform.position.x, transform.position.y + 1.6f, transform.position.z - 1f), transform.parent.transform.rotation); dragged.transform.SetParent(transform); dragged.transform.localScale = new Vector3(0.3f, 0.1f, 0.3f); dragged.name = "House Big"; Upgrade temp = dragged.AddComponent <Upgrade>(); //set up the script variables temp.UpgradeCost = 150; temp.earn = 25; temp.menu = menu; temp.level = 1; my_script.Score -= 100; temp.ex = Instantiate(ex_point, new Vector3(transform.position.x + 1f, transform.position.y + 1f, transform.position.z - 1f), transform.parent.transform.rotation); temp.ex.transform.SetParent(dragged.transform); up_txt.SetActive(true); } else { re_text.GetComponent <Text>().text = "Not enough money!"; StartCoroutine(ShowAndHide(re_text, 1.0f)); // 1 second Destroy(my_script.dragged); } } else if (my_script.dragged.name == "House Medium(Clone)") { if (my_script.Score >= 50) { occupied = true; dragged = Instantiate(my_script.dragged, new Vector3(transform.position.x, transform.position.y + 0.2f, transform.position.z - 1f), transform.parent.transform.rotation); dragged.transform.SetParent(transform); dragged.transform.localScale = new Vector3(0.3f, 0.15f, 0.3f); dragged.name = "House Medium"; Upgrade temp = dragged.AddComponent <Upgrade>(); //set up the script variables temp.UpgradeCost = 100; temp.earn = 15; temp.menu = menu; temp.level = 1; my_script.Score -= 50; temp.ex = Instantiate(ex_point, new Vector3(transform.position.x + 1f, transform.position.y + 1f, transform.position.z - 1f), transform.parent.transform.rotation); temp.ex.transform.SetParent(dragged.transform); up_txt.SetActive(true); } else { re_text.GetComponent <Text>().text = "Not enough money!"; StartCoroutine(ShowAndHide(re_text, 1.0f)); // 1 second Destroy(my_script.dragged); } } else if (my_script.dragged.name == "Bunker(Clone)") { if (my_script.Score >= 25) { occupied = true; dragged = Instantiate(my_script.dragged, new Vector3(transform.position.x, transform.position.y + 0.2f, transform.position.z - 1f), transform.parent.transform.rotation); dragged.transform.SetParent(transform); dragged.transform.localScale = new Vector3(0.3f, 0.15f, 0.3f); dragged.name = "Bunker"; Upgrade temp = dragged.AddComponent <Upgrade>(); //set up the script variables temp.UpgradeCost = 50; temp.earn = 5; temp.level = 1; my_script.Score -= 25; temp.menu = menu; temp.ex = Instantiate(ex_point, new Vector3(transform.position.x + 1f, transform.position.y + 1f, transform.position.z - 1f), transform.parent.transform.rotation); temp.ex.transform.SetParent(dragged.transform); up_txt.SetActive(true); } else { re_text.GetComponent <Text>().text = "Not enough money!"; StartCoroutine(ShowAndHide(re_text, 1.0f)); // 1 second Destroy(my_script.dragged); } } Destroy(dragged.GetComponent <DragObject>()); dragged.SetActive(true); my_script.houses.Add(dragged); Destroy(my_script.dragged); } else if (over && occupied && my_script.dragged != null) { re_text.GetComponent <Text>().text = "This place is occupied!"; StartCoroutine(ShowAndHide(re_text, 1.0f)); // 1 second Destroy(my_script.dragged); } else { Destroy(my_script.dragged); } }
public void setUpgrade(Upgrade upgrade) { this.upgrade = upgrade; }
//create active selection / floating tower on pressing a tower button public void InstantiateTower(int clickedButton) { //store the TowerManager tower index passed in as parameter index = clickedButton; //we clicked one of these tower buttons //if we already have a floating tower, destroy it and free selections if (SV.selection) { currentGrid = null; currentTower = null; Destroy(SV.selection); } //check if there are free grids left //no free grid left (list count is equal to grid count) if (gridScript.GridList.Count == gridScript.transform.GetChildCount()) { //print a warning message StartCoroutine("DisplayError", "No free grids left for placing a new tower!"); Debug.Log("No free grids left for placing a new tower!"); return; } //initialize price array with total count of resources float[] price = new float[GameHandler.resources.Length]; //cache selected upgrade options for further processment UpgOptions opt = towerScript.towerUpgrade[index].options[0]; //loop through resources //get needed resources (buy price) of this tower from upgrade list for (int i = 0; i < price.Length; i++) price[i] = opt.cost[i]; //check in case we have not enough resources left, abort purchase for (int i = 0; i < price.Length; i++) { if (GameHandler.resources[i] < price[i]) { StartCoroutine("DisplayError", "Not enough resources for buying this tower!"); Debug.Log("Not enough resources for buying this tower!"); //destroy selection CancelSelection(true); return; } } //all checks went through, we are able to purchase this tower //instantiate selected tower from TowerManager prefab list and thus create a floating tower SV.selection = (GameObject)Instantiate(towerScript.towerPrefabs[index], new Vector3(0, -200, 0), Quaternion.identity); //get new base properties of this tower instance towerBase = SV.selection.GetComponentInChildren<TowerBase>(); //change name of the gameobject holding this component to the defined one in TowerManager names list towerBase.gameObject.name = towerScript.towerNames[index]; //parent tower to the container gameobject SV.selection.transform.parent = towerContainer; //get new upgrade properties of this tower instance upgrade = SV.selection.GetComponentInChildren<Upgrade>(); //disable its base properties, so while moving/placing the tower around, it can not attack towerBase.enabled = false; //show all grid renderers to see where we could (or could not) place the tower gridScript.ToggleVisibility(true); }
internal static string UpgradeRedirect(Version version, string packageType, string packageName) { return(Upgrade.UpgradeRedirect(version, packageType, packageName, "")); }
void Start() { //get upgrade script reference upgrade = gameObject.GetComponent<Upgrade>(); //zero out rotation on shot position transform, //otherwise the field of view gets reversed if (shotPos.localRotation != Quaternion.identity) shotPos.localRotation = Quaternion.identity; //set tower script of rotating tower part if we have a turret if (turret) { //a turret with a shotAngle of zero can't work properly if(shotAngle == 0) Debug.LogWarning("Turret set on '" + gameObject.name + "' but shot angle equals zero!"); TowerRotation turScript = turret.gameObject.GetComponent<TowerRotation>(); if (turScript) turScript.towerScript = this; else Debug.LogWarning("Turret set on '" + gameObject.name + "' but no TowerRotation script attached to it!"); } //start tower AI StartInvoke(0f); }
void Upgrade(Upgrade u, Rect r) { GUI.DrawTexture (r, u.icon); if (u.bought) { GUI.Button (r,"",iconActive); } else if (u.preReq==null||u.preReq.bought) { if (GUI.Button (r,"",iconNormal)) u.Buy(); } else { GUI.Button (r,"",iconDisabled); } }
private void AddUpgradeByCost(Upgrade pUpgrade, Dictionary<Int32, List<Upgrade>> pMasterList) { if (!pMasterList.ContainsKey(pUpgrade.Cost)) pMasterList.Add(pUpgrade.Cost, new List<Upgrade>()); pMasterList[pUpgrade.Cost].Add(pUpgrade); }
private void RemoveProVersion() { //update the tab module to use CE version var tabController = new TabController(); var moduleController = new ModuleController(); TabInfo newTab; var portalController = new PortalController(); foreach (PortalInfo portal in portalController.GetPortals()) { //Update Site Redirection management page var tabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//SiteRedirectionManagement", Null.NullString); if (tabId == Null.NullInteger) { newTab = Upgrade.AddAdminPage(portal, "Site Redirection Management", "Site Redirection Management.", "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_16x16.png", "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png", true); } else { newTab = tabController.GetTab(tabId, portal.PortalID, true); newTab.IconFile = "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_16x16.png"; newTab.IconFileLarge = "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png"; tabController.UpdateTab(newTab); } //Remove Pro edition module int moduleID = Null.NullInteger; IDictionary <int, ModuleInfo> modules = moduleController.GetTabModules(newTab.TabID); if (modules != null) { foreach (ModuleInfo m in modules.Values) { if (m.DesktopModule.FriendlyName == "Site Redirection Management") { moduleID = m.ModuleID; break; } } } if (moduleID != Null.NullInteger) { moduleController.DeleteTabModule(newTab.TabID, moduleID, false); } //Add community edition module ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("DNN Site Redirection Management"); if (mDef != null) { Upgrade.AddModuleToPage(newTab, mDef.ModuleDefID, "Site Redirection Management", "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png", true); } } var package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == "DotNetNuke.Professional.MobileManagement"); if (package != null) { var installer = new Installer(package, Globals.ApplicationMapPath); installer.UnInstall(true); } }
void AddButtonListener(Button button, Upgrade upgrade) { button.onClick.AddListener(() => PlayerUpgrades.instance.BuyUpgrade(upgrade)); }
public string UpgradeModule(string Version) { try { switch (Version) { case "01.00.00": ModuleDefinitionInfo moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Messaging"); if (moduleDefinition != null) { //Add Module to User Profile Page for all Portals var objPortalController = new PortalController(); var objTabController = new TabController(); var objModuleController = new ModuleController(); ArrayList portals = objPortalController.GetPortals(); foreach (PortalInfo portal in portals) { int tabID = TabController.GetTabByTabPath(portal.PortalID, "//UserProfile", Null.NullString); if ((tabID != Null.NullInteger)) { TabInfo tab = objTabController.GetTab(tabID, portal.PortalID, true); if ((tab != null)) { int moduleId = Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "My Inbox", "", true); ModuleInfo objModule = objModuleController.GetModule(moduleId, tabID, false); var settings = new PortalSettings(portal); var modulePermission = (from ModulePermissionInfo p in objModule.ModulePermissions where p.ModuleID == moduleId && p.RoleID == settings.RegisteredRoleId && p.UserID == Null.NullInteger && p.PermissionKey == "EDIT" select p).SingleOrDefault(); if (modulePermission == null) { ArrayList permissions = new PermissionController().GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "EDIT"); PermissionInfo permission = null; if (permissions.Count == 1) { permission = permissions[0] as PermissionInfo; } if (permission != null) { modulePermission = new ModulePermissionInfo(permission) { ModuleID = moduleId, RoleID = settings.RegisteredRoleId, UserID = Null.NullInteger, AllowAccess = true }; objModule.ModulePermissions.Add(modulePermission); ModulePermissionController.SaveModulePermissions(objModule); } } } } } } break; } return("Success"); } catch (Exception exc) { Logger.Error(exc); return("Failed"); } }
public void ConfirmPopup(Upgrade upgrade, int selectorIndex) { if (!disableMenus) { GameObject popup = (GameObject)Instantiate(popupPrefab); Upgrade currUpgrade = UpgradeDatabase.upgrades[currUpgradeIds[selectorIndex]]; popup.transform.SetParent(currMenu.transform, false); //popup.transform.localPosition = new Vector3 (0, 0, 0); Button buyButton = popup.transform.GetChild(0).gameObject.GetComponent<Button>(); Button closeButton = popup.transform.GetChild(8).gameObject.GetComponent<Button>(); Image icon = popup.transform.GetChild(1).gameObject.GetComponent<Image>(); Text incomeStat = popup.transform.GetChild(2).gameObject.GetComponent<Text>(); Text carbStat = popup.transform.GetChild(3).gameObject.GetComponent<Text>(); Text durationStat = popup.transform.GetChild(4).gameObject.GetComponent<Text>(); Text pikaStat = popup.transform.GetChild(5).gameObject.GetComponent<Text>(); Text priceStat = popup.transform.GetChild(10).gameObject.GetComponent<Text>(); Text carbonComp = popup.transform.GetChild(6).gameObject.GetComponent<Text>(); Text incomeComp = popup.transform.GetChild(7).gameObject.GetComponent<Text>(); Text name = popup.transform.GetChild(9).gameObject.GetComponent<Text>(); name.text = upgrade.upgradeName; float carbonDiff = upgrade.carbonSavings - currUpgrade.carbonSavings; float incomeDiff = upgrade.monthlyIncome - currUpgrade.monthlyIncome; icon.sprite = upgrade.icon; carbStat.text = upgrade.carbonSavings + "lb"; incomeStat.text = "$" + upgrade.monthlyIncome; durationStat.text = upgrade.duration + " sec"; priceStat.text = "$" + upgrade.price.ToString(); pikaStat.text = 1.ToString(); //NEED PRICE carbonComp.text = (carbonDiff >= 0) ? "(+" + (carbonDiff) + ")" : "(" + (carbonDiff) + ")"; incomeComp.text = (incomeDiff >= 0) ? "(+" + (incomeDiff) + ")" : "(" + (incomeDiff) + ")"; Color red = new Color(0.89f, .37f, .37f); Color green = new Color(.61f, .79f, .31f); carbonComp.color = (carbonDiff > 0) ? green : red; incomeComp.color = (incomeDiff > 0) ? green : red; buyButton.onClick.AddListener(() => player.tryToBuy(upgrade.iD, this, (Slider)Instantiate(TimeMeter), selectorIndex)); buyButton.onClick.AddListener(() => GameObject.Destroy(popup)); closeButton.onClick.AddListener(() => GameObject.Destroy(popup)); } }
public int AddUpgrade(Upgrade m) { this.options.Add((Upgrade)m.DeepCopy()); return(this.options.Count() - 1); }
void Start() { script = GameObject.Find("Board").GetComponent<Upgrade>(); shootPosition = transform.FindChild("ShootingPosition"); }
/// <summary> /// Add or remove a mod from the remove list /// </summary> /// <param name="mod">The mod to add or remove</param> public void ToggleRemove(CkanModule mod) { Install.Remove(mod); Upgrade.Remove(mod.identifier); toggleContains(Remove, mod.identifier); }
public void calculateModifiers(Upgrade upgrade) { if (upgrade.carbonX > PlayerStatus.carbonX) PlayerStatus.carbonX = upgrade.carbonX; if (upgrade.incomeX > PlayerStatus.incomeX) PlayerStatus.incomeX = upgrade.incomeX; if (upgrade.durationX < PlayerStatus.durationX) PlayerStatus.durationX = upgrade.durationX; if (upgrade.priceX < PlayerStatus.priceX) PlayerStatus.priceX = upgrade.priceX; Debug.Log("Multipliers: income: " + PlayerStatus.incomeX + " carbon: " + PlayerStatus.carbonX + " speed: " + PlayerStatus.durationX); }
/// <summary> /// Add or remove a mod from the install list /// </summary> /// <param name="mod">The mod to add or remove</param> public void ToggleInstall(CkanModule mod) { Upgrade.Remove(mod.identifier); Remove.Remove(mod.identifier); toggleContains(Install, mod); }
public void ConfirmPopup(Upgrade upgrade, GameObject currItem) { GameObject popup = (GameObject)Instantiate(popupPrefab); popup.transform.SetParent(currMenu.transform, false); popup.transform.localPosition = new Vector3 (0, 0, 0); Button buyButton = popup.transform.GetChild(0).gameObject.GetComponent<Button>(); Button closeButton = popup.transform.GetChild(8).gameObject.GetComponent<Button>(); Image icon = popup.transform.GetChild(1).gameObject.GetComponent<Image>(); Text incomeStat = popup.transform.GetChild(2).gameObject.GetComponent<Text>(); Text carbStat = popup.transform.GetChild(3).gameObject.GetComponent<Text>(); Text durationStat = popup.transform.GetChild(4).gameObject.GetComponent<Text>(); Text pikaStat = popup.transform.GetChild(5).gameObject.GetComponent<Text>(); Text carbonComp = popup.transform.GetChild(6).gameObject.GetComponent<Text>(); Text incomeComp = popup.transform.GetChild(7).gameObject.GetComponent<Text>(); Text name = popup.transform.GetChild(9).gameObject.GetComponent<Text>(); Text priceStat = popup.transform.GetChild(10).gameObject.GetComponent<Text>(); name.text = upgrade.upgradeName; icon.sprite = upgrade.icon; carbStat.text = upgrade.carbonSavings + "lb /year"; incomeStat.text = "$" + upgrade.monthlyIncome + " /month"; durationStat.text = upgrade.duration + " sec"; pikaStat.text = 1.ToString(); priceStat.text = "$" + upgrade.price.ToString(); carbonComp.text = ""; incomeComp.text = ""; buyButton.onClick.AddListener(() => TryToUnlock(upgrade, currItem)); buyButton.onClick.AddListener(() => GameObject.Destroy(popup)); closeButton.onClick.AddListener(() => GameObject.Destroy(popup)); buyButton.onClick.AddListener(() => Destroy(popup)); }
/// <summary> /// Reset the plan to no changes /// </summary> public void Reset() { Install.Clear(); Upgrade.Clear(); Remove.Clear(); }
public UpgradeData(Upgrade upgrade) { Name = upgrade.Name; TimeLeft = upgrade.TimeLeft; }
public void GetupgradeLink(Upgrade link) { upgrade = link; if (upgrade.GetItemSection() == "RawMaterial") { CountEmptyStorage(); if (storageFree == 0) { increase.interactable = false; decrease.interactable = false; numberofItems = 1; number.SetText(numberofItems.ToString()); } else { if (CalculateMaxCost() > storageFree) { maxNumber = storageFree; } else { maxNumber = CalculateMaxCost(); } } } else { CountEmptyFactory(); if (factoryFree == 0) { increase.interactable = false; decrease.interactable = false; numberofItems = 1; number.SetText(numberofItems.ToString()); } else { if (CalculateMaxCost() > factoryFree) { maxNumber = factoryFree; } else { maxNumber = CalculateMaxCost(); } //max value of storage //compare cost } } if (maxNumber == 0) { increase.interactable = false; decrease.interactable = false; } if (maxNumber == 1 && numberofItems == 1) { increase.interactable = false; decrease.interactable = false; } else if (gameManager.tutorialActive) { numberofItems = 1; increase.interactable = false; decrease.interactable = false; } }
void UpgradeTooltip(Upgrade u, Rect r) { GUI.Button (r,new GUIContent("",u.Tooltip),emptyStyle); float w = skin.label.fixedWidth; float h = skin.label.CalcHeight(new GUIContent(GUI.tooltip),w); if (!string.IsNullOrEmpty(GUI.tooltip)) GUI.Label (new Rect(Mathf.Clamp (Event.current.mousePosition.x-w,5,Camera.main.pixelWidth-w-5), Mathf.Clamp (Event.current.mousePosition.y-h,5,Camera.main.pixelHeight-h-5),w,h),GUI.tooltip); GUI.tooltip = null; }
private void Update() { foreach (var kvp in LootBoxModel.Instance.UpgradeManager.UpgradeStates) { Upgrade.EUpgradeType type = kvp.Key; Upgrade upgrade = LootBoxModel.Instance.UpgradeManager.Upgrades[type]; Upgrade.EState state = kvp.Value; switch (state) { case Upgrade.EState.Hidden: { if (entries.ContainsKey(type)) { entries[type].gameObject.SetActive(false); } } break; case Upgrade.EState.Visible: { //Add the entry if necessary if (!entries.ContainsKey(type)) { UpgradeEntry entry = Instantiate(UpgradeEntryPrefab, LayoutParent.transform); entry.SetData(upgrade); entry.OnClick += () => { LootBoxModel.Instance.UpgradeManager.PurchaseUpgrade(upgrade); }; entries.Add(type, entry); } //Make sure it's enabled if (!entries[type].gameObject.activeSelf) { entries[type].gameObject.SetActive(true); } //TODO: set its state based on whether it can be afforded } break; case Upgrade.EState.Purchased: { if (entries.ContainsKey(type)) { //For now, also just disable it. Could destroy but probably not worth being clean entries[type].gameObject.SetActive(false); } } break; } if ((state != Upgrade.EState.Hidden) && !entries.ContainsKey(type)) { UpgradeEntry entry = Instantiate(UpgradeEntryPrefab, LayoutParent.transform); entry.SetData(upgrade); entry.OnClick += () => { LootBoxModel.Instance.UpgradeManager.PurchaseUpgrade(upgrade); }; entries.Add(type, entry); } } }
public SoftBlock(int x, int y, Upgrade u = null) : base(x, y) { _myUpgrade = u; }
public void Refresh(GameHandler gameHandler, MinionPool pool, int maxMana, bool decreaseFreeze = true) { int commons = gameHandler.shopRarities.common, rares = gameHandler.shopRarities.rare, epics = gameHandler.shopRarities.epic, legendaries = gameHandler.shopRarities.legendary; List <Upgrade> kept = new List <Upgrade>(); for (int i = 0; i < this.options.Count(); i++) { if (this.options[i].creatureData.staticKeywords[StaticKeyword.Freeze] > 0) { if (decreaseFreeze) { this.options[i].creatureData.staticKeywords[StaticKeyword.Freeze]--; } kept.Add((Upgrade)this.options[i].DeepCopy()); if (this.options[i].rarity == Rarity.Common) { commons--; } else if (this.options[i].rarity == Rarity.Rare) { rares--; } else if (this.options[i].rarity == Rarity.Epic) { epics--; } else if (this.options[i].rarity == Rarity.Legendary) { legendaries--; } } } this.options.Clear(); this.options = kept; List <Upgrade> subList = new List <Upgrade>(); subList = CardsFilter.FilterList <Upgrade>(pool.upgrades, x => x.rarity == Rarity.Legendary && x.Cost <= maxMana - 5); for (int i = 0; i < legendaries; i++) { Upgrade m = subList[GameHandler.randomGenerator.Next(0, subList.Count())]; this.AddUpgrade(m); } subList = CardsFilter.FilterList <Upgrade>(pool.upgrades, x => x.rarity == Rarity.Epic && x.Cost <= maxMana - 5); for (int i = 0; i < epics; i++) { Upgrade m = subList[GameHandler.randomGenerator.Next(0, subList.Count())]; this.AddUpgrade(m); } subList = CardsFilter.FilterList <Upgrade>(pool.upgrades, x => x.rarity == Rarity.Rare && x.Cost <= maxMana - 5); for (int i = 0; i < rares; i++) { Upgrade m = subList[GameHandler.randomGenerator.Next(0, subList.Count())]; this.AddUpgrade(m); } subList = CardsFilter.FilterList <Upgrade>(pool.upgrades, x => x.rarity == Rarity.Common && x.Cost <= maxMana - 5); for (int i = 0; i < commons; i++) { Upgrade m = subList[GameHandler.randomGenerator.Next(0, subList.Count())]; this.AddUpgrade(m); } this.options.Sort(); }