void CreatMap(THClimbTower.EventType type, params object[] Param) { Map map = Param[0] as Map; GTile.RemoveChildren(0, GTile.numChildren, true); GLine.RemoveChildren(0, GLine.numChildren, true); foreach (Tile tile in map.GetTiles()) { if (tile is StartTile) { continue; } GComponent btn = UIPackage.CreateObject("Map", "MapBtn").asCom; GTile.AddChild(btn); btn.GetController("c1").selectedIndex = (int)tile.Type; btn.data = tile; btn.xy = Getpos(tile.X, tile.Y); if (btn.x + 300 > GTile.width) { GTile.width = btn.x + 300; } btn.onClick.Add(async() => { if (!map.CanMove(tile)) { return; } MainView.touchable = false; await btn.GetTransition("t0").PlayAsync(); MainView.touchable = true; map.MoveNext(tile); }); btn.onRightClick.Add(() => { //tile.ShowDeltaInfo(); }); if (tile is BossTile) { continue; } foreach (Tile next in tile.GetNexts()) { //Debug.Log("Connect" + tile.pos() + "," + next.pos()); ConnectRoom(Getpos(tile.X, tile.Y), Getpos(next.X, next.Y)); } } FreshMap(THClimbTower.EventType.FreshMap, map); //FreshCards(game.player.Deck); }
void FreshMap(THClimbTower.EventType type, params object[] Param) { Map map = Param[0] as Map; foreach (GComponent g in GTile.GetChildren()) { Tile t = g.data as Tile; if (map.NowTile.tileStatus == Tile.TileStatusEnum.OnTile) { g.GetTransition("t1").Stop(); } else if (map.CanMove(t)) { g.GetTransition("t1").Play(); } else { g.GetTransition("t1").Play(); g.GetTransition("t1").Stop(); } } }
void T1(THClimbTower.EventType type, params object[] vs) { Debug.Log((int)vs[0]); }