public static void initSprite() { if (is_sprite_init) { return; } Sprite sprite; object o; Texture2D t2d; foreach (KeyValuePair <int, Card_Info> _info in Data.Inst.card_data) { //卡牌详情图 o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, card_path + _info.Value.img + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_id_card_sprite.Add(_info.Key, sprite); //手牌图 o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, hand_path + _info.Value.img + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_id_hand_sprite.Add(_info.Key, sprite); //棋子图 o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, chess_path + _info.Value.img + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_id_chess_sprite.Add(_info.Key, sprite); } string[] imgs = new string[3]; imgs[0] = "ion_por"; imgs[1] = "ion_atc"; imgs[2] = "ion_ang"; //手动初始化职业图标 for (int i = 0; i < (int)eCard_Vocation.Max; i++) { o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, vocation_path + imgs[i % imgs.Length] + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_vocation_sprite.Add((eCard_Vocation)i, sprite); } }
//升起迷雾 //static Vector3 fog_position = new Vector3(0, 0, -2); //淘汰咯,有动画就行了 public void FogCover(int[] target_players) { if (AniFog == null) { //增加sprite //aniFog = Instantiate(Resources.Load<GameObject>(PrefabPath.ChessGridFog), transform).GetComponent<Animator>(); //aniFog = Instantiate(BKTools.getBundleObject(eResBundle.Prefabs,PrefabPath.ChessGridFog), transform).GetComponent<Animator>(); aniFog = Instantiate(BKTools.LoadAsset <GameObject>(eResBundle.Prefabs, PrefabPath.ChessGridFog), transform).GetComponent <Animator>(); } if (aniFogState <= 0) { return; } aniFogState = 0; //清理标记 //Fog_flag = true; foreach (var player in target_players) { fog_flag[player] = true; } StartCoroutine(corFogCover()); }
IEnumerator corBattleStart(DramaSection section) { Main.Inst.addDancer(KEY_corBattleStart); Main.Inst.lv_ctrl.now_turn = 0; // 重新计算回合数 //存储探索进度 Main.Inst.lv_ctrl.ExplorePos = Main.Inst.moving_chess.container.number; // 遮盖已开放区域 foreach (var item in Main.Inst.lv_ctrl.AreaExplored) { BKTools.FogCover(item, 1, GameRule.ePlayerIndex); } yield return(new WaitUntil(BKTools.ISCWithArgu(KEY_corBattleStart))); //隐藏探索骑士 //Main.Inst.moving_chess.container.removeChess(); //Main.Inst.moving_chess.gameObject.SetActive(false); // 开放战斗区域 foreach (var item in Main.Inst.lv_ctrl.map_data.list_area_grid[section.area_id].list) { Main.Inst.lv_ctrl.AreaBattle.Add(item); BKTools.FogLift(item, 1, GameRule.Default_PvE_Fog_Lift_Range, GameRule.ePlayerIndex); } // 召唤玩家默认阵容 //TODO 从牌组设置读取 Main.Inst.moving_chess.container.removeChess(); Main.Inst.chess_grids[section.to_grid_id].appendChess(Main.Inst.moving_chess); //setChessPlayer(1001, ePlayer.Player1, Main.Inst.chess_grids[section.to_grid_id]); Debug.Log("草拟吗,到底能不能玩断点啦!"); // 切换阶段 (不能使用插入,不然会使得当前不止一个阶段对象响应事件——已经造成过召唤剧情成功生成未执行时被认为已经被杀光的错误 AppendPhase(Instantiate(BKTools.LoadAsset <GameObject>(eResBundle.Prefabs, PrefabPath.PlayerDrawPhase), Main.Inst.NodePhaseControler.transform).GetComponent <TurnPhase>()); Main.Inst.redDancer(KEY_corBattleStart); //召唤怪物阵容 - 由原来的事件机制完成 //设置镜头跟踪方式 Camera.main.GetComponent <ExBaCamera>().SetFollowTarget(section.area_id); analya_finish = true; }