public string getImageHLHUrl() { string ss = ""; basedir = basedir.Replace("\\", "/"); ss = basedir; if (ElectronTransferModel.Config.MapConfig.Instance.TileType == "4Tree") { //ss = basedir + "/" + TileLevel + "/" + TileRow + "/" + TileLevel + "_" + TileRow + "_" + TileCol + ".png"; ss = ss.Replace("{TileLevel}", TileLevel.ToString()); ss = ss.Replace("{TileRow}", TileRow.ToString()); ss = ss.Replace("{TileCol}", TileCol.ToString()); } else if (ElectronTransferModel.Config.MapConfig.Instance.TileType == "ZoomWayScale") { ss = ss.Replace("{TileLevel}", TileLevel.ToString()); ss = ss.Replace("{TileRow1}", (TileRow / 30 * 30).ToString()); ss = ss.Replace("{TileRow2}", (TileRow % 30).ToString()); ss = ss.Replace("{TileCol1}", (TileCol / 30 * 30).ToString()); ss = ss.Replace("{TileCol2}", (TileCol % 30).ToString()); } ImageHLHUrl = ss; return(ImageHLHUrl); }
private void OnAddLevelExecute() { var level = new TileLevel(); var lastLevel = Levels.Last(); level.Color = ControlPaint.Dark(lastLevel.Color); Levels.Add(level); level.PropertyChanged += Item_PropertyChanged; level.TotalTimeH = lastLevel.TotalTimeH + 1; }
private void OnResetLevelsExecute() { Levels.Clear(); var defLevels = TileLevel.Defaults(); foreach (var item in defLevels) { Levels.Add(item); item.PropertyChanged += Item_PropertyChanged; } }
private void LevelTimeChanged() { // Провеерка высот var levels = Levels.ToList(); levels = TileLevel.CheckAndCorrect(levels); Levels.Clear(); foreach (var item in levels) { Levels.Add(item); item.PropertyChanged += Item_PropertyChanged; } }
public static TileLevel FromBaseObject(BaseObject baseObj) { if (baseObj == null || baseObj.NativeObject == IntPtr.Zero) { return(null); } TileLevel obj = baseObj as TileLevel; if (object.Equals(obj, null)) { obj = new TileLevel(CreatedWhenConstruct.CWC_NotToCreate); obj.BindNativeObject(baseObj.NativeObject, "CTileLevel"); obj.IncreaseCast(); } return(obj); }
public override void OnStartServer() { if (!isServer) { return; } int seed = UnityEngine.Random.seed; rand = new System.Random(seed); //splits all the objects into something I can search with. DualStore <TileDetails, GameObject> gameObjects = new DualStore <TileDetails, GameObject>(); foreach (GameObject obj in TileTypes) { TileDetails details = obj.GetComponent <TileDetails>(); gameObjects.Add(details, obj); } gameObjects = GetTileset(gameObjects); Dictionary <TileSetType, TileLevel> tilesByTileSetType = new Dictionary <TileSetType, TileLevel>(); foreach (TileSetType type in Enum.GetValues(typeof(TileSetType))) { TileLevel level = new TileLevel(seed); DualStore <TileDetails, GameObject> tileSetTiles = GetTileSetType(gameObjects, type); foreach (TileType ttype in Enum.GetValues(typeof(TileType))) { level.AssignTiles(ttype, GetTileTypes(tileSetTiles, ttype)); } tilesByTileSetType.Add(type, level); } SpawnTiles(tilesByTileSetType); }
private LevelChange DrawPiratesAndCoins(TileLevel level, int levelIndex, int levelCount, Ship tileShip) { LevelChange levelChange = new LevelChange(); var pirates = level.Pirates; bool hasPirates = pirates != null && pirates.Count > 0; bool hasCoins = (tileShip != null && tileShip.Coins > 0) || level.Coins > 0; levelChange.hasPirates = hasPirates; levelChange.hasCoins = hasCoins; levelChange.Level = levelIndex; // draw pirates if (hasPirates) { DrawPirate pirate = new DrawPirate(); pirate.ForeColor = "white"; pirate.BackColor = GetTeamColor(pirates.First().TeamId); pirate.Text = pirates.Count().ToString(); levelChange.Pirate = pirate; } // draw coins if (hasCoins) { int coins = tileShip != null ? tileShip.Coins : level.Coins; DrawCoin coin = new DrawCoin(); coin.ForeColor = "black"; coin.BackColor = "gold"; coin.Text = coins.ToString(); levelChange.Coin = coin; } return(levelChange); }
public override void OnStartServer() { if (!isServer) return; int seed = UnityEngine.Random.seed; rand = new System.Random(seed); //splits all the objects into something I can search with. DualStore<TileDetails, GameObject> gameObjects = new DualStore<TileDetails, GameObject>(); foreach(GameObject obj in TileTypes) { TileDetails details = obj.GetComponent<TileDetails>(); gameObjects.Add(details, obj); } gameObjects = GetTileset(gameObjects); Dictionary<TileSetType, TileLevel> tilesByTileSetType = new Dictionary<TileSetType, TileLevel>(); foreach(TileSetType type in Enum.GetValues(typeof(TileSetType))) { TileLevel level = new TileLevel(seed); DualStore<TileDetails, GameObject> tileSetTiles = GetTileSetType(gameObjects, type); foreach(TileType ttype in Enum.GetValues(typeof(TileType))) { level.AssignTiles(ttype, GetTileTypes(tileSetTiles, ttype)); } tilesByTileSetType.Add(type, level); } SpawnTiles(tilesByTileSetType); }
private bool OnDeleteLevelCanExecute(TileLevel level) { return(Levels.Count > 1); }
private void OnDeleteLevelExecute(TileLevel level) { Levels.Remove(level); }
private void OnSelectColorExecute(TileLevel level) { level.Color = InsService.ColorPicker(level.Color); }
public BaseObject Create() { TileLevel emptyInstance = new TileLevel(CreatedWhenConstruct.CWC_NotToCreate); return(emptyInstance); }
private void DrawPiratesAndCoins(TileLevel level, int levelIndex, int levelCount, Ship tileShip) { var pirates = level.Pirates; bool hasPirates = pirates != null && pirates.Count > 0; bool hasCoins = (tileShip != null && tileShip.Coins > 0) || level.Coins > 0; int locX = 0; int locY = 0; int width = Width / 4; int height = Height / 4; CalcLocation( levelCount, levelIndex, hasCoins, ref locX, ref locY, ref width, ref height ); // draw pirates if (hasPirates) { var lblPirates = new Label(); lblPirates.ForeColor = Color.White; lblPirates.BackColor = GetTeamColor(pirates.First().TeamId); lblPirates.TextAlign = ContentAlignment.MiddleCenter; lblPirates.Size = new Size(width, height); if (levelCount == 1) { lblPirates.Font = new Font("Microsoft Sans Serif", 12); } lblPirates.Location = new Point(locX, locY); string str = ""; const char loveChar = '❤'; int inLoveCount = pirates.Count(x => x.IsInLove); if (inLoveCount > 0) { str += (inLoveCount > 1 ? inLoveCount.ToString() : "") + loveChar; } const char drunkChar = '☺'; int drunkCount = pirates.Count(x => x.IsDrunk); if (drunkCount > 0) { str += (drunkCount > 1 ? drunkCount.ToString() : "") + drunkChar; } const char inTrapChar = '☹'; int inTrapCount = pirates.Count(x => x.IsInTrap); if (inTrapCount > 0) { str += (inTrapCount > 1 ? inTrapCount.ToString() : "") + inTrapChar; } int normalCount = pirates.Count(x => x.IsDrunk == false && x.IsInTrap == false); if (normalCount > 0) { str += (normalCount > 1 ? normalCount.ToString() : "") + "P"; } lblPirates.Text = str; Controls.Add(lblPirates); } // draw coins if (hasCoins) { int coins = tileShip != null ? tileShip.Coins : level.Coins; var lblGold = new Label(); lblGold.ForeColor = Color.Black; lblGold.BackColor = Color.Gold; lblGold.TextAlign = ContentAlignment.MiddleCenter; lblGold.Size = new Size(width, height); if (levelCount == 1) { lblGold.Font = new Font("Microsoft Sans Serif", coins > 9 ? 9 : 12); locX = 2 * width; } else { locX = locX + width; } lblGold.Location = new Point(locX, locY); lblGold.Text = coins.ToString(); Controls.Add(lblGold); } }
/// <summary> /// Draw a line following a path on a tile layer. Override default line drawing /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="color"></param> protected void DrawPathLine(TileLevel layerNo, Point start, Point end, Color foregroundColor, Color backgroundColor, char drawChar) { //Draw the line overlay //Cast a line between the start and end int lastX = start.x; int lastY = start.y; foreach(Point p in Utility.GetPointsOnLine(start, end)) { //Don't draw the first char (where the player is) if(p == start) continue; if (!isViewVisible(p)) continue; char c; if (drawChar == 0) c = LineChar(p.x - lastX, p.y - lastY); else c = drawChar; lastX = p.x; lastY = p.y; tileMapLayer(layerNo)[ViewRelative(p)] = new TileEngine.TileCell(c); tileMapLayer(layerNo)[ViewRelative(p)].TileFlag = new LibtcodColorFlags(foregroundColor, backgroundColor); } }
/// <summary> /// Draw a line following a path on a tile layer. /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="color"></param> protected void DrawPathLine(TileLevel layerNo, Point start, Point end, Color foregroundColor, Color backgroundColor) { DrawPathLine(layerNo, start, end, foregroundColor, backgroundColor, (char)0); }
/// <summary> /// Returns the requested tile layer for the master map /// </summary> /// <param name="levelId"></param> /// <returns></returns> internal TileEngine.TileLayer tileMapLayer(TileLevel levelId) { return tileMap.Layer[(int)levelId]; }