private void OnChampionRemoved(Model.Champion champion_) { if (champion == champion_) { ChampionDestroyed(); } }
public void RemoveChampion(Model.Champion champion_) { if (!loaded) { return; } if (!ChampionList.Contains(champion_)) { return; } App.Server.Request( HTTPMethods.Delete, "champion/" + champion_.Json["_id"], (JSONNode json_) => { ChampionList.Remove(champion_); foreach (var almostJson in Json["champions"].AsArray) { if (almostJson.Value["_id"] == champion_.Json["_id"]) { Json["champions"].AsArray.Remove(almostJson.Value); break; } } ChampionRemoved(champion_); }).Send(); }
IEnumerator Start() { Debug.Assert(backButton != null); yield return(StartCoroutine(App.Content.Account.Load())); //return if object died while waiting for answer if (this == null) { yield break; } if (Model == null) { Model = new Model.ConstellationPreset( null, new Model.PresetLimits(App.Content.GameSettings.NumAbilities, App.Content.GameSettings.NumClasses, App.Content.GameSettings.NumKits)); } champion = App.Content.Account.ActiveChampion; List <Data.Skill.Skill> filteredSkillList = new List <Data.Skill.Skill>(); foreach (var node in Model.Constellation.AbilityNodeList) { filteredSkillList.Add(node.Skill); } foreach (var node in Model.Constellation.KitNodeList) { filteredSkillList.Add(node.Skill); } if (champion != null) { foreach (var skill in champion.ClassPreset.SelectedClassList) { filteredSkillList.Add(skill); } } else { foreach (var node in Model.Constellation.ClassNodeList) { filteredSkillList.Add(node.Skill); } } backButton.onClick.AddListener(BackClicked); nodeTextualDetails.SetContext(new ViewModel.NodeTextualDetails(hovered)); constellation.SetContext(new ViewModel.NodeMapConstellation(Model.Constellation, Model, filteredSkillList, hovered)); presetColumn.SetContext(new ViewModel.PresetColumn(Model, hovered, ViewModel.PresetColumn.Mode.Edit)); if (champion != null) { champion.PresetSaved += OnPresetSaved; } }
public ChampionColumnPreview( Model.Champion champion_, Model.HoveredSkill hovered_, bool canEdit_) { Debug.Assert(champion_ != null); champion = champion_; hovered = hovered_; canEdit = canEdit_; App.Content.Account.ChampionRemoved += OnChampionRemoved; }
public PresetColumn( Model.ConstellationPreset model_, Model.HoveredSkill hovered_, Mode mode_) { preset = model_; hovered = hovered_; champion = App.Content.Account.ActiveChampion; mode = mode_; if (preset != null) { preset.PresetUpdated += OnPresetUpdated; } if (champion != null) { champion.PresetRemoved += OnPresetRemoved; } }
public void ActivateChampion(Model.Champion champion_) { if (!loaded) { return; } if (champion_ == null || !ChampionList.Contains(champion_)) { return; } if (ActiveChampion != null) { ActiveChampion.Detach(); } ActiveChampion = champion_; ActiveChampionChanged(); }
public void AddChampion(string name, JSONArray classes) { if (!loaded) { return; } JSONObject championJson = new JSONObject(); championJson["name"] = name; championJson["level"] = 0; championJson["specializationPoints"] = 0; championJson["classes"] = classes; Debug.Log(championJson); var request = App.Server.Request( HTTPMethods.Post, "champion", (JSONNode json_) => { Model.Champion champion = new Model.Champion(json_.AsObject); ChampionList.Add(champion); Json["champions"].AsArray.Add(json_); ChampionAdded(champion); }, (JSONNode json_) => { App.Resource.Prefab.Popup().Setup( "Network error", json_.ToString()); }); request.AddHeader("Content-Type", "application/json"); request.RawData = System.Text.Encoding.UTF8.GetBytes(championJson.ToString()); request.Send(); }
private void OnChampionAdded(Model.Champion champion) { App.Content.Account.ActivateChampion(champion); App.Scene.Load("Landing"); }
private void OnChampionRemoved(Model.Champion champion) { ArrangeUI(); }