public List <PatchInfo> GetLocalBundles(LoadingInfo info, ref Dictionary <string, string> localbundles) { List <PatchInfo> lpds = new List <PatchInfo>(); var bundles = AssetVersion.Version2Bundles; for (int i = 0; i < info.patch_list.Length; i++) { var p = info.patch_list[i]; if (bundles.ContainsKey(p.version)) { var value = bundles[p.version]; for (int k = 0; k < value.Count; ++k) { if (localbundles.ContainsKey(value[k])) { localbundles[value[k]] = p.version; } else { localbundles.Add(value[k], p.version); } } } else { lpds.Add(p); } } return(lpds); }
void SetVersionList(LoadingInfo info) { for (int i = 0; i < info.patch_list.Length; i++) { var p = info.patch_list[i]; AssetVersion.AddVersionList(p.version); } }
public static void Show(UIType uitype, System.Action <IBaseUI> callback = null) { var ui = Find(uitype); if (ui != null) { ui.gameObject.SetActive(true); ui.OnShow(); callback?.Invoke(ui); return; } if (_uiCache.TryGetValue(uitype, out ui)) { _uiCache.Remove(uitype); _uiList.Add(ui); ui.gameObject.transform.SetAsLastSibling(); ui.gameObject.SetActive(true); ui.OnShow(); callback?.Invoke(ui); return; } for (var i = 0; i < _uiLoadings.Count; ++i) { if (_uiLoadings[i].UIType == uitype) { _uiLoadings[i] = new LoadingInfo { UIType = uitype, Callback = callback }; Log.Warn($"UI is Loding...{uitype}"); return; } } var info = UIConfig.All[uitype]; _uiLoadings.Add(new LoadingInfo() { UIType = uitype, Callback = callback }); AssetMgr.Instance.LoadAsync(info.PrefabPath, (asset) => { for (var i = 0; i < _uiLoadings.Count; ++i) { if (_uiLoadings[i].UIType == uitype) { ui = info.creator(); ui.gameObject = GameObject.Instantiate(asset as GameObject, Layer(info.Layer)); ui.UIType = info.UIType; _uiList.Add(ui); ui.OnAttach(); ui.OnShow(); _uiLoadings[i].Callback?.Invoke(ui); _uiLoadings.RemoveAt(i); return; } } Log.Warn($"ui{uitype}已经加载,但界面已经关了"); }); }
private void UpdateCreatingLabel(LoadingInfo loadingInfo) { int total = cellsWidth * cellsHeight; int done = (updateCellY * cellsWidth) + updateCellX + 1; float percentDone = (float)done / (float)total * 100; loadingInfo.UpdateLoading(LoadingType.CreatingMiniMap, percentDone); }
//one argument class constructor public RunAutomation(Platform platform) { this.platform = platform; #region Reference initialization helperObj = new Helper(); mainPageObj = new MainPage(); loginPageObj = new LoginPage(); comptTempObj = new ComptTempPage(); actStockObj = new ActualStockPage(); comptEditObj = new ComptEditPage(); comptCapacityObj = new ComptCapacity(); selShiftObj = new ShiftStartPage(); trpStartObj = new TripStartPage(); trvlToObj = new TravellingToPage(); kmCtrlObj = new KMControlPage(); xlRdrObj = new ExcelReader(); comptStatusObj = new ComptStatusPage(); cnfrmDepotObj = new ConfirmDepotPage(); cnfrmNameObj = new ConfirmNamePage(); plannedLdgObj = new PlannedLoading(); actualLdgObj = new ActualLoading(); ldgSummaryObj = new LoadingSummary(); ldgInfoObj = new LoadingInfo(); ovrdCodeobj = new OverrideNoMixCode(); comptAssgnObj = new ComptAssignmentPage(); custSelObj = new CustomerSelection(); delDetailsObj = new DeliveryDetails(); custArrivalObj = new CustomerArrival(); plndDelDetObj = new PlannedDeliveryDetails(); rvwTnkDipsObj = new ReviewTankDips(); delSchemeObj = new DeliveryScheme(); prodDschgObj = new ProductDischarge(); cnfrmDelObj = new ConfirmDelivery(); adrobj = new ADRStart(); breakObj = new BreakPage(); tripendObj = new TripEndPage(); shiftendObj = new ShiftEndPage(); #endregion xlRdrObj.GetCompleteExcelData(); isSpotTrailer = Convert.ToBoolean(xlRdrObj.GetValueFromSheet("TrailerDetails", "SpotTrailer")); noOfCompt = xlRdrObj.GetValueFromSheet("TrailerDetails", "NoOfCompartments"); comptCapacity = xlRdrObj.GetValueFromSheet("TrailerDetails", "CompartmentCapacity"); tankNo1 = xlRdrObj.GetValueFromSheet("TrailerDetails", "TankNumber1"); tankNo2 = xlRdrObj.GetValueFromSheet("TrailerDetails", "TankNumber2"); tankNo3 = xlRdrObj.GetValueFromSheet("TrailerDetails", "TankNumber3"); stockVal1 = Convert.ToInt32(xlRdrObj.GetValueFromSheet("TrailerDetails", "StockValue1")); stockVal2 = Convert.ToInt32(xlRdrObj.GetValueFromSheet("TrailerDetails", "StockValue2")); stockVal3 = Convert.ToInt32(xlRdrObj.GetValueFromSheet("TrailerDetails", "StockValue3")); stockVal = stockVal1 + stockVal1 + stockVal3; calculatedValue = new int[Convert.ToUInt32(noOfCompt)]; }
public LandMass(Tile[,] tileGrid, double[,] waterMap, LoadingInfo loadingInfo) { //following number is amount of ground layers groundLevels = new double[50]; float value = -5.5f; for (int i = 0; i < groundLevels.Length; i++) { groundLevels[i] = value; value += 0.20f; } float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < CreatingWorld.worldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.BuildingLandMass, percentDone); for (int y = 0; y < CreatingWorld.worldHeight; y++) { if (tileGrid[x, y] == null) { int layerIndex = GetLayerIndex(waterMap[x, y]); LayerType layerType = (LayerType)layerIndex; if (layerIndex > waterCoastline) { Tile tile = new Tile(GroundLayerController.GetRandomLayer(layerType), TileLogisticsController.GetTileLogistic(LandType.OPEN, 0), x, y); tileGrid[x, y] = tile; } else { Tile tile = new Tile(GroundLayerController.GetRandomLayer(layerType), TileLogisticsController.GetTileLogistic(LandType.WATER, 0), x, y); tileGrid[x, y] = tile; } if (x == 0 || x == CreatingWorld.worldWidth - 1 || y == 0 || y == CreatingWorld.worldHeight - 1) { Tile tile = new Tile(GroundLayerController.GetLayerByIndex(LayerType.BORDER, 0), TileLogisticsController.GetTileLogistic(LandType.BORDER, 0), x, y); tileGrid[x, y] = tile; } } } } }
private IEnumerator UpdateInfoText(float next) { if (!m_tipText) { yield break; } Util.SetText(m_tipText, LoadingInfo.SelectRandomInfo(m_infoID)); if (next <= 0) { yield break; } var wait = new WaitForSeconds(next); yield return(wait); StartCoroutine(UpdateInfoText(next)); }
public bool Create(LoadingInfo loadingInfo) { miniMapCellGrid[updateCellX, updateCellY] = new MiniMapCell(updateCellX, updateCellY, tilesPerCell, tilePixel); updateCellX++; if (updateCellX >= cellsWidth) { updateCellX = 0; updateCellY++; if (updateCellY >= cellsHeight) { updateCellY = 0; updateCellX = 0; return(true); } } UpdateCreatingLabel(loadingInfo); return(false); }
//Instead of just having a level //make the level determine the chance of a tree landing there public AddingTrees(Tile[,] tileGrid, double[,] treeMap, LoadingInfo loadingInfo) { Random rnd = GameController.GetRandomWithSeed(); double treeLevel = 0; //-6 to positive 6 float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < CreatingWorld.worldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.AddingTrees, percentDone); for (int y = 0; y < CreatingWorld.worldHeight; y++) { //basically between 0 and 200 int i = (int)((treeMap[x, y] + 8)) * 10; if (rnd.Next(0, 200) < i) { if (treeMap[x, y] > treeLevel) { if (tileGrid[x, y].GetChildObject() == null && tileGrid[x, y].GetLandType() == Game.LandType.OPEN) { float p = (float)(rnd.Next(500, 800)) / 1000f; int type = rnd.Next(0, 8); Tree tree = MapObjectController.GetTree(type); MapObject mapObject = new MapObject(tree, x, y, Color.White, p); TileLogistic tileLogistic = TileLogisticsController.GetTileLogistic(LandType.TREE, 0); tileGrid[x, y].AddMapObject(mapObject, false, false, true, tileLogistic, true); } } } } } }
public ShrunkWorldBuilder(Tile[,] tileGrid, ShrunkNode[,] shrunkMap, LoadingInfo loadingInfo) { float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < shrunkWorldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.BuildingShrunkWorld, percentDone); for (int y = 0; y < shrunkWorldHeight; y++) { LandType landType = LandType.OPEN; for (int checkX = (x * 2); checkX < (x * 2) + 2; checkX++) { for (int checkY = (y * 2); checkY < (y * 2) + 2; checkY++) { if (tileGrid[checkX, checkY].GetLandType() == LandType.WATER) { landType = LandType.WATER; break; } if (tileGrid[checkX, checkY].GetLandType() == LandType.BORDER) { landType = LandType.BORDER; break; } } if (landType == LandType.WATER) { break; } } shrunkMap[x, y] = new ShrunkNode(landType); } } }
public double[,] GenerateNoiseMap(int octaves, float frequency, float amplitude, bool reseed, LoadingInfo loadingInfo, bool updateInfo, Random rnd, int width, int height) { float percentDone = 0; float percentJump = 100f / octaves / width; var data = new float[width * height]; double[,] tempArray = new double[width, height]; /// track min and max noise value. Used to normalize the result to the 0 to 1.0 range. var min = float.MaxValue; var max = float.MinValue; if (reseed) { Reseed(rnd); } //var persistence = 0.25f; i dont know what this does for (var octave = 0; octave < octaves; octave++) { for (var i = 0; i < width; i++) { percentDone += percentJump; if (updateInfo) { loadingInfo.UpdateLoading(LoadingType.CreatingPerlinNoise, percentDone); } for (var j = 0; j < height; j++) { var noise = Noise(i * frequency * 1f / width, j * frequency * 1f / height); noise = data[j * width + i] += noise * amplitude; tempArray[i, j] = noise; min = Math.Min(min, noise); max = Math.Max(max, noise); } } frequency *= 2; amplitude /= 2; } return(tempArray); }
public TownSitesBuilder(ShrunkNode[,] shrunkMap, List <Town> townList, ref List <Point> connectionList, LoadingInfo loadingInfo) { float percentDone = 0; float percentJump = 100f / CreatingWorld.numberOfTowns; Random rnd = GameController.GetRandomWithSeed(); InitTownNames(); int numberOfChecks = 5000; bool safeDistance; distanceBetweenTowns = GetDistanceBetweenTowns(); int townId = 0; for (int i = 0; i < numberOfChecks; i++) { //TODO: take this next line out i just like this map for debugging //rndExtras = GameController.rnd; Point checkingPoint = new Point(rnd.Next(offSetFromEdge, ShrunkWorldBuilder.shrunkWorldWidth), rnd.Next(offSetFromEdge, ShrunkWorldBuilder.shrunkWorldHeight - offSetFromEdge)); safeDistance = false; if (ShrunkWorldBuilder.IsOpen(checkingPoint, shrunkMap)) { safeDistance = true; foreach (Town otherTown in townList) { if (IsToCloseDistance(checkingPoint, otherTown.GetShrunkPoint())) { safeDistance = false; break; } } } if (safeDistance) { townList.Add(new Town(checkingPoint, townId, GetTownName(rnd))); townId++; percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.PlottingTownPoints, percentDone); } if (townList.Count == CreatingWorld.numberOfTowns) { break; } } connectionList = CreateConnectionList(townList); }
public ModifyingIntersectionRoadId(Tile[,] tileGrid, ShrunkNode[,] shrunkMap, LoadingInfo loadingInfo) { float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < ShrunkWorldBuilder.shrunkWorldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.FixingIntersections, percentDone); for (int y = 0; y < ShrunkWorldBuilder.shrunkWorldHeight; y++) { int amount = CountNeighbourRoadsShrunkMap(shrunkMap, new Point(x, y)); Point expanded = new Point(x * 2, y * 2); if (amount > 2) { FixSpot(expanded, tileGrid); } } } }
public ConnectingTowns(ref List <Town> townList, ref List <Point> connectionList, ShrunkNode[,] shrunkMap, LoadingInfo loadingInfo) { float percentDone = 0; float percentJump = 100f / connectionList.Count; int townStartId; int targetid; Dictionary <int, Boolean> connectedList = new Dictionary <int, bool>(); for (int i = 0; i < townList.Count; i++) { if (i == 0) { connectedList.Add(i, false); } else { connectedList.Add(i, false); } } int numberofTowns = townList.Count; for (int i = 0; i < connectionList.Count; i++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.ConnectingTowns, percentDone); townStartId = connectionList[i].X; targetid = connectionList[i].Y; Point startPoint = townList[townStartId].GetShrunkPoint(); Point endPoint = townList[targetid].GetShrunkPoint(); List <Point> connectingPoints = new List <Point>(); AStarRoadBuildingNew aStar = new AStarRoadBuildingNew(); connectingPoints = aStar.GetTravelList(startPoint, endPoint, shrunkMap, targetid); UpdateShrunkMap(connectingPoints, townStartId, shrunkMap); } }
public CreatingIntersections(Tile[,] tileGrid, ShrunkNode[,] shrunkMap, List <Intersection> intersectionList, LoadingInfo loadingInfo) { Random rnd = GameController.GetRandomWithSeed(); int id = 1; float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < ShrunkWorldBuilder.shrunkWorldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.AddingIntersections, percentDone); for (int y = 0; y < ShrunkWorldBuilder.shrunkWorldHeight; y++) { int amount = CountNeighbourRoadsShrunkMap(shrunkMap, new Point(x, y)); Point expanded = new Point(x * 2, y * 2); if (amount > 2 && rnd.Next(0, 100) < chanceToKeepThreeWay || amount > 3) { if (CountNeighbourRoadsNormalMap(tileGrid, expanded) > 2) { AddIntersection(intersectionList, tileGrid, shrunkMap, x, y, expanded, rnd, id); id++; } } else if (amount > 2) { if (CountNeighbourRoadsNormalMap(tileGrid, expanded) > 2) { AddTurningArrows(tileGrid, expanded, 1); } } } } }
public TownsAndRoads(Tile[,] tileGrid, List <Intersection> intersectionList, List <Town> townList, LoadingInfo loadingInfo) { ShrunkWorldBuilder.shrunkWorldWidth = CreatingWorld.worldWidth / 2; ShrunkWorldBuilder.shrunkWorldHeight = CreatingWorld.worldHeight / 2; shrunkMap = new ShrunkNode[ShrunkWorldBuilder.shrunkWorldWidth, ShrunkWorldBuilder.shrunkWorldHeight]; // DebugLine("ShrunkWorldBuilder"); ShrunkWorldBuilder shrunkWorldBuilder = new ShrunkWorldBuilder(tileGrid, shrunkMap, loadingInfo); // DebugLine("TownSitesBuilder"); TownSitesBuilder townSitesBuilder = new TownSitesBuilder(shrunkMap, townList, ref connectionList, loadingInfo); // DebugLine("BuildingTownRoads"); BuildingTownRoads buildingTownRoads = new BuildingTownRoads(townList, shrunkMap, shrunkPlotList, loadingInfo); // DebugLine("ClearingShrunkPlotErrors"); ClearingShrunkPlotErrors clearingShrunkPlotErrors = new ClearingShrunkPlotErrors(shrunkMap, shrunkPlotList); // DebugLine("ExpandShrunkPlot"); ExpandShrunkPlot expandShrunkPlot = new ExpandShrunkPlot(shrunkPlotList, townList, loadingInfo); // DebugLine("ConnectingTowns"); ConnectingTowns connectingTowns = new ConnectingTowns(ref townList, ref connectionList, shrunkMap, loadingInfo); // DebugLine("ClearingRoadErrors"); ClearingRoadErrors clearingRoadErrors = new ClearingRoadErrors(shrunkMap, loadingInfo); // DebugLine("ExpandShrunkWorld"); ExpandShrunkWorld expandShrunkWorld = new ExpandShrunkWorld(tileGrid, shrunkMap, loadingInfo); // DebugLine("LoadingTownBuildings"); LoadingTownBuildings loadingTownBuildings = new LoadingTownBuildings(buildingList); // DebugLine("AddingTownBuildings"); AddingTownBuildings addingTownBuildings = new AddingTownBuildings(buildingList, tileGrid, townList, loadingInfo); // DebugLine("AddingRoadTiles"); AddingRoadTiles addingRoadTiles = new AddingRoadTiles(tileGrid, loadingInfo); // DebugLine("CreatingIntersections"); CreatingIntersections creatingIntersections = new CreatingIntersections(tileGrid, shrunkMap, intersectionList, loadingInfo); // DebugLine("ModifyingIntersectionRoadId"); ModifyingIntersectionRoadId modifyingIntersectionRoadId = new ModifyingIntersectionRoadId(tileGrid, shrunkMap, loadingInfo); // DebugLine("AddingStreetLights"); AddingStreetLights addingStreetLights = new AddingStreetLights(tileGrid, shrunkMap, loadingInfo); }
private void Start() { info = GameObject.Find("GameManager").GetComponent <LoadingInfo>(); }