public static MissionMap loadMissionFromTemplate(string link, int cost) { var textAsset = (TextAsset)Resources.Load(link); var xmldoc = new XmlDocument(); xmldoc.LoadXml(textAsset.text); var map = xmldoc.GetElementsByTagName("map").Item(0); var listPoints = new List <MapPoint>(); foreach (XmlNode xmlMapPoint in map) { var mapPoint = new MapPoint(); mapPoint.fightPower = int.Parse(xmlMapPoint["power"].InnerText); mapPoint.type = parseMapPoint(xmlMapPoint["type"].InnerText); listPoints.Add(mapPoint); } var missionMap = new MissionMap(); missionMap.cost = cost; float summory = 0.0f; for (int i = 0; i < listPoints.Count; i++) { summory += listPoints[i].fightPower; } for (int i = 0; i < listPoints.Count; i++) { var mp = new MapPoint(); mp.fightPower = (int)(missionMap.cost * listPoints[i].fightPower / summory); mp.count = generateCount(listPoints[i].type); mp.id = i; mp.isFinal = i == listPoints.Count - 1; if (i > 0) { mp.dependList.Add((i - 1).ToString()); } mp.isEnable = mp.dependList.Count == 0; mp.position = new Vector2(i + 1, 1); missionMap.fights.Add(mp); } return(missionMap); }
private void init() { missionMap = MapFactory.loadMissionFromTemplate("configs/maps/templates/smallRoadToBoss", 1000); missionMap.currentMapPoint = null; background = "texture/main_scene"; var image = Resources.Load <Sprite>(background); transform.Find(Constants.BACKGROUND).GetComponent <SpriteRenderer>().sprite = image; printFightPoints(); PartiesSingleton.currentGame.activeHeroes.Clear(); PartiesSingleton.currentGame.activeHeroes.AddRange(PartiesSingleton.currentGame.selectedHeroes); foreach (var p in PartiesSingleton.currentGame.activeHeroes) { p.initHealthMana(); } }
public MissionMap loadMissionFromFile(string link) { var missionMap = new MissionMap(); var textAsset = (TextAsset)Resources.Load(link); var xmldoc = new XmlDocument(); xmldoc.LoadXml(textAsset.text); var map = xmldoc.GetElementsByTagName("map").Item(0); foreach (XmlNode xmlMapPoint in map) { var mapPoint = new MapPoint(); mapPoint.id = int.Parse(xmlMapPoint["id"].InnerText); mapPoint.fightPower = int.Parse(xmlMapPoint["fightPower"].InnerText); mapPoint.count = int.Parse(xmlMapPoint["count"].InnerText); if (xmlMapPoint["final"] != null && xmlMapPoint["final"].InnerText == "true") { mapPoint.isFinal = true; } else { mapPoint.isFinal = false; } if (xmlMapPoint["dependList"].InnerText.Length > 0) { mapPoint.dependList.AddRange(xmlMapPoint["dependList"].InnerText.Split(',')); } mapPoint.position = XMLFactory.laodPosition(xmlMapPoint["position"]); if (mapPoint.dependList.Count == 0) { mapPoint.isEnable = true; } missionMap.fights.Add(mapPoint); } return(missionMap); }
public MissionLaunchDispatcher(MissionMap missionMap) { MissionMap = missionMap; }
public override void Execute() { WriteLiteral("\r\n"); #line 8 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" string selectedCategory = this.SelectedCategory; MissionMap missionMap = this.MissionMap; MissionControlOptions options = this.Options; Layout = new LayoutPage(Title); var availableMissions = missionMap.Missions.Where(x => x.Value.CategoryName == selectedCategory).Select(x => x.Value).ToArray(); #line default #line hidden WriteLiteral("\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\""); #line 16 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.To("/mission-control/css/styles")); #line default #line hidden WriteLiteral("\" />\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\""); #line 17 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.To("/mission-control/css/bootstrap-datetimepicker")); #line default #line hidden WriteLiteral("\" />\r\n<script>\r\n var baseUrl = \""); #line 19 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.To("/mission/launch")); #line default #line hidden WriteLiteral("\";\r\n var idFieldName = \""); #line 20 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Mission.IdField); #line default #line hidden WriteLiteral("\";\r\n var jobLinkBaseUrl = \""); #line 21 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.JobDetails("")); #line default #line hidden WriteLiteral("\";\r\n var requireConfirmation = "); #line 22 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(options.RequireConfirmation.ToString().ToLowerInvariant()); #line default #line hidden WriteLiteral(";\r\n</script>\r\n<script type=\"text/javascript\" src=\""); #line 24 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.To("/mission-control/js/moment")); #line default #line hidden WriteLiteral("\"></script>\r\n<script defer type=\"text/javascript\" src=\""); #line 25 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.To("/mission-control/js/bootstrap-datetimepicker")); #line default #line hidden WriteLiteral("\"></script>\r\n<script defer type=\"text/javascript\" src=\""); #line 26 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Url.To("/mission-control/js/page")); #line default #line hidden WriteLiteral("\"></script>\r\n\r\n<div class=\"row\">\r\n <div class=\"col-md-3\">\r\n "); #line 30 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(CategoriesSidebar.Render(Html, selectedCategory, missionMap)); #line default #line hidden WriteLiteral("\r\n </div>\r\n <div class=\"col-md-9\">\r\n <h1 class=\"page-header\">"); #line 33 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(selectedCategory); #line default #line hidden WriteLiteral("</h1>\r\n"); #line 34 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" if (availableMissions.Length == 0) { #line default #line hidden WriteLiteral(" <div class=\"alert alert-warning\" role=\"alert\">\r\n No mi" + "ssions for selected category are available\r\n </div>\r\n"); #line 39 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" } #line default #line hidden WriteLiteral("\r\n"); #line 41 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" foreach (var mission in availableMissions) { #line default #line hidden WriteLiteral(" <div class=\"panel panel-default\">\r\n <div class=\"panel-" + "heading\">\r\n <div class=\"btn-group\">\r\n " + "<a role=\"button\" data-toggle=\"collapse\" href=\"#"); #line 46 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Id); #line default #line hidden WriteLiteral("-panel\" aria-expanded=\"false\">\r\n <h3 class=\"panel-titl" + "e\">"); #line 47 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Name); #line default #line hidden WriteLiteral("</h3>\r\n </a>\r\n </div>\r\n " + "</div>\r\n <div id=\""); #line 51 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Id); #line default #line hidden WriteLiteral("-panel\" class=\"panel-body collapse\">\r\n"); #line 52 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" if (!string.IsNullOrWhiteSpace(mission.Description)) { #line default #line hidden WriteLiteral(" <p>"); #line 54 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Description); #line default #line hidden WriteLiteral("</p>\r\n"); #line 55 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" } #line default #line hidden WriteLiteral("\r\n <div class=\"job-snippet\">\r\n <div cla" + "ss=\"job-snippet-code\">\r\n <pre><code>"); #line 59 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(MissionRenderer.RenderMission(mission.MethodInfo)); #line default #line hidden WriteLiteral("</code></pre>\r\n </div>\r\n </div>\r\n\r\n " + " <form id=\""); #line 63 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Id); #line default #line hidden WriteLiteral("\" autocomplete=\"off\">\r\n"); #line 64 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" foreach (var parameter in mission.MethodInfo.GetParameters()) { var control = ControlFactory.CreateControl(parameter); if (control is NullControl) { continue; } #line default #line hidden WriteLiteral(" <div class=\"form-group\">\r\n " + " "); #line 70 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(Html.RenderPartial(control)); #line default #line hidden WriteLiteral("\r\n </div>\r\n"); #line 72 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" } #line default #line hidden WriteLiteral("\r\n <button type=\"button\" class=\"btn btn-info\" onclick=\"onM" + "issionStart(this, \'"); #line 74 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Id); #line default #line hidden WriteLiteral("\');\">Enqueue</button>\r\n </form>\r\n </div>\r\n " + " <div id=\""); #line 77 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" Write(mission.Id); #line default #line hidden WriteLiteral("-alerts\" class=\"panel-footer hidden\"></div>\r\n </div>\r\n"); #line 79 "..\..\Dashboard\Pages\MissionsOverviewPage.cshtml" } #line default #line hidden WriteLiteral(" </div>\r\n</div>\r\n"); }
public MissionsOverviewPage(string selectedCategory, MissionMap missionMap, MissionControlOptions options) { SelectedCategory = selectedCategory; MissionMap = missionMap; Options = options; }
public static NonEscapedString Render(HtmlHelper helper, string selectedCategory, MissionMap missionMap) => helper.RenderPartial(new CategoriesSidebar(selectedCategory, missionMap));
public CategoriesSidebar(string selectedCategory, MissionMap missionMap) { SelectedCategory = selectedCategory; MissionMap = missionMap; }