public MapCardBase CreateMapCard() { ModelTableSetting model = null; switch (CardType) { case MapCardType.None: break; case MapCardType.Door: MapCard = new MapCardDoor(); MapCard.Position = Pos; MapCard.State = MapCardBase.CardState.Behind; ResourceManager.LoadGameObject("MapCard/" + typeof(MapCardDoor).ToString(), LoadAssetSuccessess, LoadAssetFailed, MapCard); break; case MapCardType.Monster: BattleMonsterTableSetting battleMonster = BattleMonsterTableSettings.Get(DataId); model = ModelTableSettings.Get(battleMonster.ModelId); MapCard = new MapCardDoor(); MapCard.Position = Pos; MapCard.State = MapCardBase.CardState.Behind; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, MapCard); break; case MapCardType.Shop: ShopTableSetting shopTable = ShopTableSettings.Get(DataId); model = ModelTableSettings.Get(shopTable.ModelId); MapCard = new MapCardDoor(); MapCard.Position = Pos; MapCard.State = MapCardBase.CardState.Behind; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, MapCard); break; case MapCardType.Box: BoxTableSetting boxTable = BoxTableSettings.Get(DataId); model = ModelTableSettings.Get(boxTable.ModelId); MapCard = new MapCardDoor(); MapCard.Position = Pos; MapCard.State = MapCardBase.CardState.Behind; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, MapCard); break; case MapCardType.NPC: NpcTableSetting npcTable = NpcTableSettings.Get(DataId); model = ModelTableSettings.Get(npcTable.ModelId); MapCard = new MapCardDoor(); MapCard.Position = Pos; MapCard.State = MapCardBase.CardState.Behind; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, MapCard); break; default: break; } return MapCard; }
public static MapCardBase CreateMapCard(MapCardType mapCardType, int mapcardId, MapCardPos pos) { MapCardBase mapCard = null; MapCardTableSetting mapCardTable = MapCardTableSettings.Get(mapcardId); if (mapCardTable == null) { return(null); } ModelTableSetting model = ModelTableSettings.Get(mapCardTable.ModelId); if (model == null) { return(null); } switch (mapCardType) { case MapCardType.None: break; case MapCardType.Door: mapCard = new MapCardDoor(); mapCard.Position = pos; mapCard.State = MapCardBase.CardState.Behind; mapCard.CardType = mapCardType; mapCard.TableData = mapCardTable; ResourceManager.LoadGameObject("MapCard/" + typeof(MapCardDoor).ToString(), LoadAssetSuccessess, LoadAssetFailed, mapCard); break; case MapCardType.Monster: BattleMonsterTableSetting battleMonster = BattleMonsterTableSettings.Get(mapcardId); //model = ModelTableSettings.Get(battleMonster.ModelId); mapCard = new MapCardMonster(); mapCard.Position = pos; mapCard.State = MapCardBase.CardState.Behind; mapCard.CardType = mapCardType; mapCard.TableData = mapCardTable; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, mapCard); break; case MapCardType.Shop: ShopTableSetting shopTable = ShopTableSettings.Get(mapcardId); //model = ModelTableSettings.Get(shopTable.ModelId); mapCard = new MapCardShop(); mapCard.Position = pos; mapCard.State = MapCardBase.CardState.Behind; mapCard.CardType = mapCardType; mapCard.TableData = mapCardTable; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, mapCard); break; case MapCardType.Box: BoxTableSetting boxTable = BoxTableSettings.Get(mapcardId); //model = ModelTableSettings.Get(boxTable.ModelId); mapCard = new MapCardBox(); mapCard.Position = pos; mapCard.State = MapCardBase.CardState.Behind; mapCard.CardType = mapCardType; mapCard.TableData = mapCardTable; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, mapCard); break; case MapCardType.NPC: NpcTableSetting npcTable = NpcTableSettings.Get(mapcardId); //model = ModelTableSettings.Get(npcTable.ModelId); mapCard = new MapCardNpc(); mapCard.Position = pos; mapCard.State = MapCardBase.CardState.Behind; mapCard.CardType = mapCardType; mapCard.TableData = mapCardTable; ResourceManager.LoadGameObject(model.Path, LoadAssetSuccessess, LoadAssetFailed, mapCard); break; default: break; } return(mapCard); }
protected override void OnInit() { npcData = NpcTableSettings.Get(TableData.DataId); }