private void updateNonDisList() { GridPanel panel = nondislist.PrimaryGrid; panel.Rows.Clear(); foreach (var cid in AllShipConfigs.instance.ShipCids) { ShipConfig sc = AllShipConfigs.instance.getShip(cid); var dlist = tools.configmng.instance.getDisShipList(); if (sc != null && dlist.ContainsKey(sc.cid.ToString()) == false && sc.cid < 20000000) { object[] vals = new object[6]; UserShip us = new UserShip(); us.shipCid = sc.cid; us.level = 1; us.battleProps = new ShipBattleProps(); us.battlePropsMax = new ShipBattleProps(); us.battleProps.hp = 1; us.battlePropsMax.hp = 1; vals[0] = "添加"; vals[1] = tools.helper.getstartstring(sc.star); vals[2] = tools.helper.getshiptype(sc.type); vals[3] = sc.title; vals[4] = null;//tools.helper.getShipSmallImage(us); vals[5] = sc.cid; GridRow gr = new GridRow(vals); panel.Rows.Add(gr); gr.RowHeight = 30; } } }
internal void tryaddtodis(int rowindex, int shipcid) { GridPanel p = nondislist.PrimaryGrid; int cid = (int)p.GetCell(rowindex, 5).Value; ShipConfig sc = AllShipConfigs.instance.getShip(cid); if (cid == shipcid) { object[] vals = new object[6]; UserShip us = new UserShip(); us.shipCid = sc.cid; us.level = 1; us.battleProps = new ShipBattleProps(); us.battlePropsMax = new ShipBattleProps(); us.battleProps.hp = sc.hp; us.battlePropsMax.hp = sc.hpMax; vals[0] = p.GetCell(rowindex, 1).Value; vals[1] = p.GetCell(rowindex, 2).Value; vals[2] = p.GetCell(rowindex, 3).Value; vals[3] = tools.helper.getShipSmallImage(us); vals[4] = "移除"; vals[5] = cid; GridRow gr = new GridRow(vals); dislist.PrimaryGrid.Rows.Add(gr); gr.RowHeight = 30; p.Rows.Remove(p.Rows[rowindex]); } //var sc = AllShipConfigs.instance.getShip(cid); tools.configmng.instance.adddisship(cid, tools.helper.getstartstring(sc.star) + " " + sc.title); //EditorCell.GridRow.Cells[1].CellStyles.Default.Background = new DevComponents.DotNetBar.SuperGrid.Style.Background(s == "吃掉" ? Color.White : Color.LightGreen); }
public void UpdateDetails(int _selectedShip, int _selectedType) { selectedShip = _selectedShip; selectedType = _selectedType; int shipIndex = gameData.shipsUIItems[selectedShip].types[selectedType].associatedShipIndex; if (GlobalData.instance.saveData.shipsInfo[shipIndex].isUnlocked) { achievementParent.SetActive(false); statsParent.SetActive(true); nameText.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].name); description.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].description); powerName.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].powerName); powerDescription.text = LocalizationManager.GetLocalizedText(gameData.shipsUIItems[selectedShip].types[selectedType].powerDescription); ShipConfig shipConfig = gameData.ships[shipIndex]; life.text = "- " + LocalizationManager.GetLocalizedText("SHIPS_DETAILS_LIFE") + (int)(shipConfig.lifePrecent * 100) + "%"; dps.text = "- " + LocalizationManager.GetLocalizedText("SHIPS_DETAILS_DAMAGE") + (int)(shipConfig.damagePrecent * 100) + "%"; mana.text = "- " + LocalizationManager.GetLocalizedText("SHIPS_DETAILS_MANA") + (int)(shipConfig.manaPrecent * 100) + "%"; } else { AchievementUI achiev = gameData.achievementsUI[gameData.shipsUIItems[selectedShip].types[selectedType].associatedAchievementIndex]; achievementParent.SetActive(true); statsParent.SetActive(false); nameText.text = LocalizationManager.GetLocalizedText("SHIPS_DETAILS_LOCKED"); description.text = gameData.shipsUIItems[selectedShip].types[selectedType].associatedAchievementIndex < 12 ? LocalizationManager.GetLocalizedText("SHIPS_DETAILS_ACHIEVEMENT_REQUIRED") : LocalizationManager.GetLocalizedText("SHIPS_DETAILS_UPGRADE_REQUIRED"); achivementImage.sprite = achiev.icon; powerName.text = LocalizationManager.GetLocalizedText(achiev.name); powerDescription.text = LocalizationManager.GetLocalizedText(achiev.description); } }
public void UpdateShip(ShipConfig config) { this.shipConfig = config; this.commonShip.UpdateShip(this.shipConfig); this.commonShip.CheckInit(); this.fullColor.ShowColorOf(config.star); }
private void ListAttributes( ShipConfig cfg, Dictionary <string, float> attributes ) { Texture2D info = EditorGUIUtility.FindTexture("console.infoicon.sml"); Texture2D warn = EditorGUIUtility.FindTexture("console.warnicon.sml"); attributes.ToList() .ForEach( attr => { EditorGUILayout.BeginHorizontal(); string label = ObjectNames.NicifyVariableName(attr.Key); EditorGUILayout.LabelField( $"{label}:", this.LabelStyle ); GUIContent content = new GUIContent( $"{attr.Value}", attr.Value < 0 ? warn : info ) { tooltip = this.ListAttribute(cfg, attr.Key) }; EditorGUILayout.LabelField(content); EditorGUILayout.EndHorizontal(); } ); }
private string ListAttribute(ShipConfig cfg, string attr) { string list = ""; if ("mass" == attr) { list = $"{cfg.name}: {cfg.mass}\n"; } else if ("size" == attr) { list = $"{cfg.name}: {cfg.size}\n"; } foreach (ComponentConfig c in cfg.components) { Dictionary <string, float> dict = null == c ? new Dictionary <string, float>() : c.Dict(); if (dict.TryGetValue(attr, out float v)) { if (!v.AboutZero()) { list += $"{c.name}: {v}\n"; } } } return(list.Length > 0 ? list.Trim() : "Couldn't break down"); }
protected virtual void Start() { ShipConfig shipConfig = GlobalData.instance.gameData.ships[GlobalData.instance.saveData.selectedShip]; damageInfluencer = shipConfig.damagePrecent + GlobalData.instance.saveData.damageUpgradeNb * shipConfig.damageUpgradeRaise; maxFireDuration *= 1 + GlobalData.instance.saveData.cooldownUpgradeNb * shipConfig.cooldownUpgradeRaise; coolDownDuration *= 1 - GlobalData.instance.saveData.cooldownUpgradeNb * shipConfig.cooldownUpgradeRaise; }
public static void CreateAsset() { ShipConfig shipConfig = ScriptableObject.CreateInstance <ShipConfig>(); AssetDatabase.CreateAsset(shipConfig, "Assets/ShipConfigs/newShipConfig.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = shipConfig; }
private void GenerateSummary() { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Summary", EditorStyles.boldLabel); ShipConfig cfg = (ShipConfig)this.serializedObject.targetObject; Dictionary <string, float> dict = cfg.Aggregate(); this.ListAttributes(cfg, dict); this.EstimateCapacityRecharge(dict); }
protected virtual void Start() { GameData gameData = GlobalData.instance.gameData; SaveData saveData = GlobalData.instance.saveData; ShipConfig shipData = gameData.ships[saveData.selectedShip]; maxMana = gameData.shipBaseStats.maxMana * (shipData.manaPrecent + saveData.manaUpgradeNb * shipData.manaUpgradeRaise); mana = maxMana; EventDispatcher.DispatchEvent(Events.SPECIAL_POWER_CREATED, this); //to activate the UI }
public void setShips(ShipConfig[] shipList) { this.ships = new Dictionary<int, ShipConfig>(); this.shipCardIndexConfig = new Dictionary<int, ShipConfig>(); this._shipCids = new List<int>(); foreach (ShipConfig config in shipList) { this._shipCids.Add(config.cid); this.ships[config.cid] = config; this.shipCardIndexConfig[config.shipIndex] = config; } }
void Start() { _transform = GetComponent <Transform>(); SaveData saveData = GlobalData.instance.saveData; ShipConfig shipconfig = GlobalData.instance.gameData.ships[saveData.selectedShip]; maxStock = saveData.bombUpgradeNb * shipconfig.bombStockUpgradeRaise; currentStock = maxStock; damage = baseDamage * (1 + saveData.bombDamageUpgradeNb * shipconfig.bombDamagePerUpgrade); EventDispatcher.DispatchEvent(Events.BOMB_USED, this); //init UI; EventDispatcher.AddEventListener(Events.BOMB_COLLECTIBLE_TAKEN, OnBombCollectibleTaken); }
// Use this for initialization void Start() { comboDownTimer = comboDownInterval; timeStart = Time.time; EventDispatcher.AddEventListener(Events.COLLECTIBLE_TAKEN, CollectibleTaken); EventDispatcher.AddEventListener(Events.ENEMY_DIED, KilledEnemy); EventDispatcher.AddEventListener(Events.PLAYER_DIED, OnPlayerDeath); EventDispatcher.AddEventListener(Events.PLAYER_HIT, PlayerHit); EventDispatcher.AddEventListener(Events.DIFFICULTY_CHANGED, DifficultyChanged); ShipConfig shipConfig = GlobalData.instance.gameData.ships[GlobalData.instance.saveData.selectedShip]; shipGoldPercent = shipConfig.goldPercent + GlobalData.instance.saveData.goldUpgradeNb * shipConfig.goldUpgradeRaise; difficultyGoldMultiplier = PlayerPrefs.GetFloat("GoldMultiplier", 1); }
private void button1_Click(object sender, EventArgs e) { int i = 0; foreach (int scid in AllShipConfigs.instance.ShipCids) { DataServer.instance.cookie = ""; DataServer.instance.ChoosedServerAddress = "http://s8.zj.p7game.com/"; if (i >= integerInput1.Value && i < integerInput1.Value + 10) { ShipConfig ssc = AllShipConfigs.instance.getShip(scid); System.Threading.Thread.Sleep(3000); var reg = ServerRequestManager.instance.DoRegister("ohtomatok48" + i, "test123", "11133322344566", "", "p777"); //var reg = ServerRequestManager.instance.QuickRegister(tools.configmng.deviceUniqueIdentifier + "zd" + i, ""); //System.Threading.Thread.Sleep(3000); //if (reg != null && reg.loginResponse.eid != 0) //{ // reg = ServerRequestManager.instance.DoRegister("ohtomatok38" + i, "test123", "13800138000", "", "p777"); //} if (reg != null && reg.loginResponse != null && reg.loginResponse.eid == 0) { string uid = reg.loginResponse.userId; System.Threading.Thread.Sleep(3000); ServerRequestManager.instance.ChooseInitShipAndName("heiheitoma48" + i, ssc.cid.ToString()); System.Threading.Thread.Sleep(3000); ServerRequestManager.instance.Login(uid); System.Threading.Thread.Sleep(3000); ServerRequestManager.instance.GetInitData(); UserShip us = GameData.instance.UserShips.First(); z.log("[reg] " + ssc.cid + " " + ssc.title + " => " + us.ship.cid + " " + us.ship.title); addresult(us, ssc); } System.Threading.Thread.Sleep(3000); } i++; } integerInput1.Value = integerInput1.Value + 10; }
private void addresult(UserShip us, ShipConfig sc) { var panel = dislist.PrimaryGrid; if (sc != null) { object[] vals = new object[6]; vals[0] = "" + sc.cid + "-" + sc.title; vals[1] = tools.helper.getstartstring(sc.star); vals[2] = tools.helper.getshiptype(sc.type); vals[3] = sc.title; vals[4] = tools.helper.getShipSmallImage(us); vals[5] = sc.cid; GridRow gr = new GridRow(vals); panel.Rows.Add(gr); gr.RowHeight = 30; } }
private void updateDisList() { GridPanel panel = dislist.PrimaryGrid; panel.Rows.Clear(); var dlist = tools.configmng.instance.getDisShipList(); foreach (var cid in dlist.Keys) { try { ShipConfig sc = AllShipConfigs.instance.getShip(int.Parse(cid)); if (sc != null) { object[] vals = new object[6]; UserShip us = new UserShip(); us.shipCid = sc.cid; us.level = 1; us.battleProps = new ShipBattleProps(); us.battlePropsMax = new ShipBattleProps(); us.battleProps.hp = sc.hp; us.battlePropsMax.hp = sc.hpMax; vals[0] = tools.helper.getstartstring(sc.star); vals[1] = tools.helper.getshiptype(sc.type); vals[2] = sc.title; vals[3] = tools.helper.getShipSmallImage(us); vals[4] = "移除"; vals[5] = sc.cid; GridRow gr = new GridRow(vals); panel.Rows.Add(gr); gr.RowHeight = 30; } }catch (Exception e) { } } }
public ShipConfig GetConfig() { ShipConfig s = new ShipConfig(); DynData <ShipConfig> shdyn = new DynData <ShipConfig>(s); shdyn.Set <Amplitude.StaticString>("Name", GetName()); shdyn.Set <int>("AbscissaValue", GetIndex()); shdyn.Set <int>("LevelCount", GetLevelCount()); string[] bps = GetInitialBlueprints(); shdyn.Set <string[]>("InitBluePrints", bps); string[] ubps = GetUnavailableBlueprints(); shdyn.Set <string[]>("UnavailableBluePrints", ubps); string[] unItems = GetUnavailableItems(); shdyn.Set <string[]>("UnavailableItems", unItems); shdyn.Set <ShipConfig.ItemDatatableReference[]>("InitialItems", new ShipConfig.ItemDatatableReference[] { }); return(s); }
private void NewGame_TextChanged(object sender, TextChangedEventArgs e) { TextBox textBox = (TextBox)sender; int id = (int)textBox.Tag; ShipConfig shipConfig = this.configs.FirstOrDefault(sc => sc.ID == id); if (shipConfig == null) { return; } int value; if (int.TryParse(textBox.Text, out value)) { int total = 0; configs.ForEach(config => { total += newGame.GetCount(config.ID); }); if (value < 0) { newGame.SetCount(id, shipConfig.Count); } else if (total < this.N) { //it's ok } else { newGame.SetCount(id, 0); } } else { //all bad newGame.SetCount(id, shipConfig.Count); } }
public static void ParseXml(string path) { XDocument xml = XDocument.Load(path); var configurations = xml.Root.Elements("Configuration"); foreach (var elem in configurations) { var id = int.Parse(elem.Attribute("ID").Value); var Path = elem.Element("Path").Value; var length = int.Parse(elem.Element("Length").Value); var count = int.Parse(elem.Element("Count").Value); dic[id] = Path; configs[id] = new ShipConfig() { ID = id, Count = count, Length = length }; } }
void Start() { _transform = GetComponent <Transform>(); _collider = GetComponent <BoxCollider2D>(); anim = sprite.GetComponent <PlayerCustomAnimator>(); spriteRender = sprite.GetComponent <SpriteRenderer>(); difficultyLifeMultiplier = PlayerPrefs.GetFloat("PlayerLifeMultiplier", 1); gameData = GlobalData.instance.gameData; SaveData saveData = GlobalData.instance.saveData; ShipConfig config = gameData.ships[saveData.selectedShip]; maxLife = gameData.shipBaseStats.maxLife * (config.lifePrecent + saveData.lifeUpgradeNb * config.lifeUpgradeRaise) * difficultyLifeMultiplier; _collider.size = gameData.shipBaseStats.hitboxSize * (config.hitboxSizePercent - saveData.hitboxUpgradeNb * config.hitboxUpgradeRaise); currentInvicibiltyDuration = gameData.shipBaseStats.invicibiltyDuration * config.invicibiltyDurationPercent; currentLife = maxLife; initalColor = spriteRender.color; EventDispatcher.AddEventListener(Events.DIFFICULTY_CHANGED, DifficultyChanged); EventDispatcher.DispatchEvent(Events.PLAYER_CREATED, this); }
public void UpdateShip([Optional, DefaultParameterValue(null)] UserShip ship) { if (ship != null) { this.userShip = ship; } if (this.userShip != null) { this.shipConfig = this.userShip.ship; } }
public void UpdateShip(ShipConfig shipConfig) { this.shipConfig = shipConfig; }
public override void SetRankItem(LeaderBoardBasicData data) { this.data1 = data as LBDataDestroy; this.config = AllShipConfigs.instance.getShip(this.data1.shipCid); base.SetRankItem(data); }
public void UpdateShip(UserShip ship) { if (!this.IsNotSelfShip) { this.userShip = GameData.instance.GetShipById(ship.id); } else { this.userShip = ship; } this.config = this.userShip.ship; this.showCardInfo.UpdateShip(ship); this.fullColor.ShowColorOf(this.config.star); this.showCardInfo.CheckInit(); this.UpdateBasicInfo(); this.UpdateAllWeapons(); this.UpdateAllProps(); this.UpdateLockStatus(); this.UpdateSkillInfo(); this.UpdateLoveInfo(); }
public void ShowShipCard(ShipConfig sc) { GameObject obj2 = UnityEngine.Object.Instantiate(this.showCardInfoPrefab) as GameObject; obj2.GetComponent<ShowDetailedCardInfo>().UpdateShip(sc); }
public void UpdateProp(UserShip userShip, StrenthenType sType, int toAddValue) { this.userShip = userShip; this.config = userShip.ship; this.sType = sType; this.toAddValue = toAddValue; this.UpdateAll(); }
public void UpdateShip(ShipConfig ship, int index) { this.shipConfig = ship; this.index = index; }
public bool IsCardReleased(int index) { ShipConfig config = this.getShipAtIndex(index); return((config != null) && (config.release == 1)); }
private void updateDrop(string nodename) { try { var response = p.GetAsync(tools.helper.count_server_addr + "/analyze/" + nodename + ".json").Result; response.EnsureSuccessStatusCode(); var content = response.Content.ReadAsByteArrayAsync().Result; string ss = System.Text.Encoding.UTF8.GetString(content); NodeDrop list = new JsonFx.Json.JsonReader().Read <NodeDrop>(ss); GridPanel panel = droplist.PrimaryGrid; panel.Rows.Clear(); int totalcount = 0; foreach (var cl in list.nodeval) { totalcount += cl.count; } float t = (float)totalcount; float allfire = 0.0f; float alltorpedo = 0.0f; float alldef = 0.0f; float allantiair = 0.0f; float dist = t; float alloil = 0.0f; float allammo = 0.0f; float allsteel = 0.0f; float allal = 0.0f; foreach (var cl in list.nodeval) { object[] vals = new object[6]; vals[0] = cl.name; vals[1] = cl.count; float c = (float)cl.count; vals[2] = "" + (c * 100.0f / t) + "%"; ShipConfig sc = AllShipConfigs.instance.getShipByName(cl.name); if (sc != null) { allfire += (float)(sc.strengthenSupplyExp.atk * cl.count); alltorpedo += (float)(sc.strengthenSupplyExp.torpedo * cl.count); alldef += (float)(sc.strengthenSupplyExp.def * cl.count); allantiair += (float)(sc.strengthenSupplyExp.air_def * cl.count); if (sc.star <= 3) { alloil += (float)(sc.dismantle["2"] * cl.count); allammo += (float)(sc.dismantle["3"] * cl.count); allsteel += (float)(sc.dismantle["4"] * cl.count); allal += (float)(sc.dismantle["9"] * cl.count); } else { dist -= cl.count; } } GridRow gr = new GridRow(vals); panel.Rows.Add(gr); gr.RowHeight = 20; label2.Text = "火力: +" + (allfire / t); label3.Text = "雷装: +" + (alltorpedo / t); label4.Text = "装甲: +" + (alldef / t); label5.Text = "防空: +" + (allantiair / t); label9.Text = "油: +" + (alloil / dist); label8.Text = "弹: +" + (allammo / dist); label6.Text = "钢: +" + (allsteel / dist); label7.Text = "铝: +" + (allal / dist); } } catch (Exception) { } }
public void UpdateShip(ShipConfig ship) { this.shipConfig = ship; this.showCardInfo.UpdateShip(ship); this.showCardInfo.CheckInit(); this.ShowShipInfo(); this.UpdatePropsText(); }
private void UpdateProps() { if (this.targetShip == null) { foreach (tk2dClippedSprite sprite in this.strengthenPercentSprite) { sprite.ClipRect = new Rect(0f, 0f, 0f, 1f); } foreach (tk2dTextMesh mesh in this.strengthenPercentTm) { mesh.text = string.Empty; mesh.Commit(); } } else { this.config = this.targetShip.ship; List<float> list = new List<float>(); list.Add(this.StrenAmount(this.targetShip.strengthenAttribute.atk, this.config.strengthenTop.atk)); list.Add(this.StrenAmount(this.targetShip.strengthenAttribute.torpedo, this.config.strengthenTop.torpedo)); list.Add(this.StrenAmount(this.targetShip.strengthenAttribute.def, this.config.strengthenTop.def)); list.Add(this.StrenAmount(this.targetShip.strengthenAttribute.air_def, this.config.strengthenTop.air_def)); for (int i = 0; i < this.strengthenPercentSprite.Length; i++) { tk2dClippedSprite sprite2 = this.strengthenPercentSprite[i]; sprite2.ClipRect = new Rect(0f, 0f, list[i], 1f); tk2dTextMesh mesh2 = this.strengthenPercentTm[i]; if (list[i] >= 1f) { mesh2.text = this.passedColor + ((int) (list[i] * 100f)) + "%"; } else { mesh2.text = this.failedColor + ((int) (list[i] * 100f)) + "%"; } mesh2.Commit(); } } }
private void UpdateProps() { if (this.targetShip == null) { foreach (tk2dTextMesh mesh in this.requireMentTMs) { mesh.text = "^Cffffffff---"; mesh.Commit(); } } else { List<string> list = new List<string>(); this.config = this.targetShip.ship; UserInfo userInfo = this.gamedata.UserInfo; list.Add(this.GetColoredStringOf(this.targetShip.level, this.config.evoLevel)); list.Add(this.GetColoredStringOf(this.gamedata.GetItemAmount(this.config.evoNeedItemCid), this.GetAmountOf(this.config.evoNeedItemCid))); list.Add(this.GetColoredStringOf(userInfo.oil, this.GetAmountOf(2))); list.Add(this.GetColoredStringOf(userInfo.ammo, this.GetAmountOf(3))); list.Add(this.GetColoredStringOf(userInfo.steel, this.GetAmountOf(4))); list.Add(this.GetColoredStringOf(userInfo.aluminium, this.GetAmountOf(9))); for (int i = 0; i < this.requireMentTMs.Length; i++) { this.requireMentTMs[i].text = list[i]; this.requireMentTMs[i].Commit(); } } }
private static string ShipConfig_GetLocalizedDescription(On.ShipConfig.orig_GetLocalizedDescription orig, ShipConfig self) { SeedCollection collection = GetMostCurrentSeeds(self.Name, 1); if (collection != null && collection.Enabled) { return(orig(self) + "\n\n" + SeedColor + "Seeds: " + collection.GetSeedForShipLevel(self.Name, 1).DungeonSeed + "," + collection.GetSeedForShipLevel(self.Name, 1).RandomGeneratorSeed + SeedColor); } return(orig(self)); }