public static bool AddNewMarker(SaveLua.Marker NewMarker) { if (!AllMarkersDictionary.ContainsKey(NewMarker.Name)) { AllMarkersDictionary.Add(NewMarker.Name, NewMarker); return(true); } return(false); }
public void Load(MapLua.SaveLua.Marker RegisterMarker) { Marker = RegisterMarker; Name = Marker.Name; zoom = Marker.zoom; canSetCamera = Marker.canSetCamera; canSyncCamera = Marker.canSyncCamera; size = Marker.size; amount = Marker.amount; }
public void Load(MapLua.SaveLua.Marker RegisterMarker) { Marker = RegisterMarker; Name = Marker.Name; zoom = Marker.zoom; canSetCamera = Marker.canSetCamera; canSyncCamera = Marker.canSyncCamera; size = Marker.size; amount = Marker.amount; offset = Marker.offset; scale = Marker.scale; effectTemplate = Marker.EffectTemplate; }
public List <ScenarioLua.Army> GetSymmetryArmies(ScenarioLua.Army army) { var allArmies = GetAllScenarioArmies(false); string armyName = army.Name; SaveLua.Marker ArmyMarker = SaveLua.GetMarker(armyName); List <ScenarioLua.Army> ToReturn = new List <ScenarioLua.Army>(); if (ArmyMarker == null) { return(ToReturn); } for (int i = 0; i < Selection.SelectionManager.Current.SymetrySelection.Length; i++) { GameObject foundMarker = Selection.SelectionManager.Current.SymetrySelection[i].FindBestSymmetry(ArmyMarker.MarkerObj.gameObject); if (foundMarker == null) { continue; } Markers.MarkerObject markerObject = foundMarker.GetComponent <Markers.MarkerObject>(); if (markerObject == null) { continue; } if (foundMarker.name == armyName) { continue; } for (int a = 0; a < allArmies.Count; a++) { if (allArmies[a].Name == foundMarker.name) { if (!ToReturn.Contains(allArmies[a])) { ToReturn.Add(allArmies[a]); } break; } } } return(ToReturn); }
public void UpdateArmys() { Clean(); if (MapLuaParser.Current.ScenarioLuaFile.Data.Configurations.Length == 0 || MapLuaParser.Current.ScenarioLuaFile.Data.Configurations[0].Teams.Length == 0) { return; } var AllArmies = MapLuaParser.Current.ScenarioLuaFile.Data.Configurations[0].Teams[0].Armys; for (int a = 0; a < AllArmies.Count; a++) { MapLua.SaveLua.Marker ArmyMarker = MapLua.SaveLua.GetMarker(AllArmies[a].Name); if (ArmyMarker != null && ArmyMarker.MarkerObj != null && ArmyMarker.MarkerType == MapLua.SaveLua.Marker.MarkerTypes.BlankMarker) { GameObject NewBut = Instantiate(ArmyButtonPrefab) as GameObject; NewBut.transform.SetParent(Pivot); ArmyButtons.Add(NewBut.GetComponent <ArmyMinimapButton>()); ArmyButtons[a].Controler = this; ArmyButtons[a].InstanceId = a; ArmyButtons[a].ArmyId = a; ArmyButtons[a].ArmyTeam = 0; //ArmyInfo.GetArmyId(MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[m].Name, out ArmyButtons[i].ArmyId, out ArmyButtons[i].ArmyTeam); //ArmyButtons[i].Name.text = MapLuaParser.Current.SaveLuaFile.Data.MasterChains[mc].Markers[m].Name.ToString(); ArmyButtons[a].Name.text = (a + 1).ToString(); Vector3 IconPos = ArmyMarker.MarkerObj.transform.localPosition; IconPos.y = IconPos.z; IconPos.z = 0; IconPos.x /= MapLuaParser.GetMapSizeX() / 10f; IconPos.y /= MapLuaParser.GetMapSizeY() / 10f; IconPos.x *= ImageSize; IconPos.y *= ImageSize; NewBut.GetComponent <RectTransform>().localPosition = IconPos; } } UpdateAutoteam(); }
public void GenerateIds(int defaultId = 0) { gameObject.SetActive(true); Clean(); if (MapLuaParser.Current.ScenarioLuaFile.Data.Configurations.Length == 0 || MapLuaParser.Current.ScenarioLuaFile.Data.Configurations[0].Teams.Length == 0) { return; } var AllArmies = MapLuaParser.Current.ScenarioLuaFile.Data.Configurations[0].Teams[0].Armys; for (int a = 0; a < AllArmies.Count; a++) { MapLua.SaveLua.Marker ArmyMarker = MapLua.SaveLua.GetMarker(AllArmies[a].Name); if (ArmyMarker != null && ArmyMarker.MarkerObj != null && ArmyMarker.MarkerType == MapLua.SaveLua.Marker.MarkerTypes.BlankMarker) { GameObject NewBut = Instantiate(ButtonPrefab) as GameObject; NewBut.transform.SetParent(Pivot); ArmyButtons.Add(NewBut.GetComponent <ArmyIdButton>()); ArmyButtons[a].Controler = this; ArmyButtons[a].Id = a; ArmyButtons[a].ArmyId = a; ArmyButtons[a].ArmyTeam = 0; //ArmyInfo.GetArmyId(AllArmies[a].Name, out ArmyButtons[i].ArmyId, out ArmyButtons[i].ArmyTeam); ArmyButtons[a].Name.text = (a + 1).ToString(); NewBut.GetComponent <RectTransform>().localPosition = Vector3.up * -27 * a; if (a == defaultId) { ArmyButtons[a].Select.color = new Color(0.15f, 0.15f, 0.5f, 1); } } } }
public void OnRenderObject() { if (PreviewTex.IsPreview || !MapLuaParser.IsMapLoaded) { return; } if (!Markers.MarkersControler.Current.MarkerLayersSettings.SpawnRanges) { return; } lineMaterial.SetPass(0); var scenario = MapLuaParser.Current.ScenarioLuaFile.Data; for (int c = 0; c < scenario.Configurations.Length; c++) { for (int t = 0; t < scenario.Configurations[c].Teams.Length; t++) { for (int a = 0; a < scenario.Configurations[c].Teams[t].Armys.Count; a++) { MapLua.SaveLua.Marker ArmyMarker = MapLua.SaveLua.GetMarker(scenario.Configurations[c].Teams[t].Armys[a].Name); if (ArmyMarker != null && ArmyMarker.MarkerObj != null && ArmyMarker.MarkerType == MapLua.SaveLua.Marker.MarkerTypes.BlankMarker) { Vector3 pos = ArmyMarker.MarkerObj.transform.localPosition; for (int i = 0; i < UtilityRanges.Length; i++) { RenderUnitRanges.DrawDottedCircle(pos, UtilityRanges[i], BuildRangeColor); } for (int i = 0; i < AtackRanges.Length; i++) { RenderUnitRanges.DrawDottedCircle(pos, AtackRanges[i], AttackRangeColor); } } } } } }
public void ChangeSelectedToId(int newId, int newT) { if (MapLuaParser.Current.ScenarioLuaFile.Data.Configurations.Length == 0 || MapLuaParser.Current.ScenarioLuaFile.Data.Configurations[0].Teams.Length == 0) { return; } var AllArmies = MapLuaParser.Current.ScenarioLuaFile.Data.Configurations[0].Teams[0].Armys; MapLua.SaveLua.Marker FromMarker = MapLua.SaveLua.GetMarker(AllArmies[SelectedArmy].Name); MapLua.SaveLua.Marker ToMarker = MapLua.SaveLua.GetMarker(AllArmies[newId].Name); if (ToMarker != null && FromMarker != null) { Undo.Current.RegisterMarkersMove(false); Vector3 OldPos = FromMarker.MarkerObj.Tr.localPosition; FromMarker.MarkerObj.Tr.localPosition = ToMarker.MarkerObj.Tr.localPosition; ToMarker.MarkerObj.Tr.localPosition = OldPos; } UpdateArmys(); }
public static void AddNewMarker(SaveLua.Marker NewMarker) { AllMarkersDictionary.Add(NewMarker.Name, NewMarker); }