//弹出一个指定窗口 public void Popup(ViewBaseView view) { if (view == null) { return; } bool err = true; for (int i = views.Count - 1; i >= 0; --i) { if (views[i].GetInstanceID() == view.GetInstanceID()) { views.RemoveAt(i); PopupSingleView(view); err = false; break; } } if (err) { UtilityLog.LogError(string.Format("Popup view failed. Can not find {0} in {1}", view.config.viewName, UIViewLayer)); return; } //刷新最大order RefreshTopOrder(); }
//添加一个生物实例展示 public void AchieveOneMinion(CardEntry minionCellItem, HexGridItem hexGridItem, MinionGridMediator minionGridMediator) { Vector3 position = new Vector3(); HexCoordinates showHexCoordinates = HexCoordinates.ReverseFromOffsetCoordinates(minionCellItem.nowIndex.X, minionCellItem.nowIndex.Z, hexGridItem.modelInfo.arrayMode); position = MinionMetrics.erectPosition(position, showHexCoordinates.X, showHexCoordinates.Z, hexGridItem.modelInfo.arrayMode); position.y = 1f; //创建一个生物实例 MinionCellView cell = minionCellPool.Pop(); cell.transform.SetParent(transform, false); cell.transform.localPosition = position; cell.minionCellItem = minionCellItem; cell.playerCode = minionGridMediator.playerCode; TextMeshProUGUI atkAndDef = UtilityHelper.FindChild <TextMeshProUGUI>(cell.transform, "MinionCellLabel"); atkAndDef.text = minionCellItem.atk.ToString() + "-" + minionCellItem.def.ToString(); //添加绑定信息 cell.OnPointerEnter = () => { minionGridMediator.SendNotification( UIViewSystemEvent.UI_VIEW_CURRENT, cell, StringUtil.GetNTByNotificationTypeAndUIViewNameAndOtherTypeAndDelayedProcess( UIViewSystemEvent.UI_VIEW_CURRENT_OPEN_ONE_VIEW, UIViewConfig.getNameStrByUIViewName(UIViewName.OneCardAllInfo), "MinionCellView", "N" ) ); }; cell.OnPointerExit = () => { minionGridMediator.SendNotification( UIViewSystemEvent.UI_VIEW_CURRENT, UIViewConfig.getNameStrByUIViewName(UIViewName.OneCardAllInfo), StringUtil.GetNTByNotificationTypeAndDelayedProcess( UIViewSystemEvent.UI_VIEW_CURRENT_CLOSE_ONE_VIEW, "N" ) ); }; cell.OnPointerDown = (CardEntry downMinionCellItem) => { minionGridMediator.SendNotification( OperateSystemEvent.OPERATE_SYS, downMinionCellItem, OperateSystemEvent.OPERATE_SYS_POINTER_DOWN_ONE_MINION ); }; cell.OnPointerUp = (CardEntry upMinionCellItem) => { }; minionCellViews.Add(minionCellItem.nowIndex, cell); MinionCellMaterialChange(cell, minionCellItem); UtilityLog.Log("生成一个生物:" + minionCellItem.cardInfo.name, LogUtType.Operate); }
//根据名称获取配置 private UIViewConfig GetConfig(UIViewName viewName) { if (uiViewConfig.ContainsKey(viewName) == false) { UtilityLog.LogError(string.Format("Get view config error: {0}", viewName)); return(null); } return(uiViewConfig[viewName]); }
//获取指定玩家的信息 public PlayerItem getPlayerByPlayerCode(string playerCode) { PlayerItem returnItem = playerGroup.playerItems[playerCode]; if (returnItem == null) { UtilityLog.LogError("玩家信息为空"); } return(returnItem); }
//根据code获取一张卡信息 public CardInfo GetCardInfoByCode(string cardCode) { CardInfo cardInfo = cardDbItem.cardInfoMap[cardCode]; if (cardInfo == null) { UtilityLog.LogError("the card [" + cardCode + "]is null"); } return(cardInfo); }
//触发后判断效果是否可以执行 public void SelectEffectAfterTrigger(List <EffectInfo> effectInfos, CardEntry ttsCardEntry, PlayerItem playerItemNotification, string notificationType) { foreach (EffectInfo effectInfo in effectInfos) { //如果是规则效果,那么需要将效果所有者设置成当前玩家 if (effectInfo.impactType == "GameModelRule") { effectInfo.player = playerItemNotification; } foreach (ImpactTimeTrigger impactTimeTrigger in effectInfo.impactTimeTriggerList) { if (impactTimeTrigger.impactTimeTriggertMonitor == notificationType) { //触发了效果 for (int n = 0; n < impactTimeTrigger.impactTimeTriggertClaims.Length; n++) { //判断触发点的所有权 if (impactTimeTrigger.impactTimeTriggertClaims[n] == "Owner") { //触发点是自己 if (impactTimeTrigger.impactTimeTriggertClaimsContents[n] == "Myself") { if (playerItemNotification == effectInfo.player) { //触发成功,要先清除掉效果的目标列 effectInfo.CleanEffectTargetSetList(); //设置状态 effectInfo.effectInfoStage = EffectInfoStage.UnStart; effectInfo.cardEntry.triggeredEffectInfo = effectInfo; UtilityLog.Log("效果【" + effectInfo.description + "】被【" + playerItemNotification.playerCode + "】触发", LogUtType.Effect); SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, effectInfo.cardEntry, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_TRIGGERED_CARD); } } } if (impactTimeTrigger.impactTimeTriggertClaims[n] == "UUId") { if (impactTimeTrigger.impactTimeTriggertClaimsContents[n] == "ThisCard") { if (ttsCardEntry.uuid == effectInfo.cardEntry.uuid) { //触发成功,要先清除掉效果的目标列 effectInfo.CleanEffectTargetSetList(); //设置状态 effectInfo.effectInfoStage = EffectInfoStage.UnStart; effectInfo.cardEntry.triggeredEffectInfo = effectInfo; UtilityLog.Log("效果【" + effectInfo.description + "】被【" + ttsCardEntry.code + "】触发", LogUtType.Effect); SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, effectInfo.cardEntry, EffectExecutionEvent.EFFECT_EXECUTION_SYS_EXE_TRIGGERED_CARD); } } } } } } } }
//添加信号发射 public void AddTimeTrigger(CardEntry minionCellItem) { minionCellItem.ttAttributeChange = () => { SendNotification(MinionSystemEvent.MINION_VIEW, minionCellItem, MinionSystemEvent.MINION_VIEW_MINION_CHANGE_ATTRIBUTE); }; //buff发生了变化 minionCellItem.ttBuffChange = () => { SendNotification(UIViewSystemEvent.UI_ONE_CARD_ALL_INFO, minionCellItem, UIViewSystemEvent.UI_ONE_CARD_ALL_INFO_BUFF_CHANGE); }; //buff需要被移除 minionCellItem.ttBuffNeedRemove = () => { SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, minionCellItem, EffectExecutionEvent.EFFECT_EXECUTION_SYS_MINION_BUFF_NEED_REMOVE); }; //生物准备发起一次攻击 minionCellItem.ttLaunchAnAttack = () => { UtilityLog.Log("玩家【" + minionCellItem.controllerPlayerItem.playerCode + "】的生物【" + minionCellItem.name + "】发起一次攻击", LogUtType.Attack); SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, minionCellItem, EffectExecutionEvent.EFFECT_EXECUTION_SYS_LAUNCH_AN_ATTACK); }; //生物进行一次攻击 minionCellItem.ttExecuteAnAttack = () => { SendNotification(MinionSystemEvent.MINION_VIEW, minionCellItem, MinionSystemEvent.MINION_VIEW_ATTACK_TARGET_MINION); }; //生物发起一次移动 minionCellItem.ttLaunchAnMove = () => { UtilityLog.Log("玩家【" + minionCellItem.controllerPlayerItem.playerCode + "】的生物【" + minionCellItem.name + "】发起一次移动", LogUtType.Attack); SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, minionCellItem, EffectExecutionEvent.EFFECT_EXECUTION_SYS_LAUNCH_AN_MOVE); }; //生物进行一次移动 minionCellItem.ttExecuteAnMove = () => { SendNotification(MinionSystemEvent.MINION_VIEW, minionCellItem, MinionSystemEvent.MINION_VIEW_MOVE_TARGET_HEX_CELL); }; //生物死亡 minionCellItem.ttCardMinionIsDead = () => { SendNotification(MinionSystemEvent.MINION_VIEW, minionCellItem, MinionSystemEvent.MINION_VIEW_ONE_MINION_IS_DEAD); SendNotification(MinionSystemEvent.MINION_SYS, minionCellItem, MinionSystemEvent.MINION_SYS_ONE_MINION_IS_DEAD); }; //生物进入战场 minionCellItem.ttMinionIntoBattlefield = () => { SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, minionCellItem, EffectExecutionEvent.EFFECT_EXECUTION_SYS_MINION_ENTER_THE_BATTLEFIELD); }; //生物被牺牲 minionCellItem.ttMinionToSacrifice = () => { minionCellItem.ttCardMinionIsDead(); }; }
//执行效果 public void ExecutionEffectContentList(EffectInfoProxy effectInfoProxy, GameContainerProxy gameContainerProxy) { //if (effectInfoProxy.effectSysItem.cardEntry.gameContainerType == "CardHand") { // effectInfoProxy.effectSysItem.cardEntry.ttCardNeedHideInView(effectInfoProxy.effectSysItem.cardEntry); //} for (int n = 0; n < effectInfoProxy.effectSysItem.effectInfos.Count; n++) { EffectInfo effectInfo = effectInfoProxy.effectSysItem.effectInfos[n]; UtilityLog.Log("开始执行效果【" + effectInfo.code + "】", LogUtType.Effect); effectInfo.effectInfoStage = EffectInfoStage.Executing; if (effectInfo.effectType == "Independent") { ExecutionOneEffectContent(effectInfoProxy, effectInfo, gameContainerProxy); } else if (effectInfo.effectType == "BeforeAndAfter") { bool allPreEffectExe = true; //遍历每一个前置效果 foreach (EffectInfo preEffect in effectInfo.preEffectEntryList) { UtilityLog.Log("执行前置效果", LogUtType.Special); if (preEffect.userChooseExecution) { UtilityLog.Log("执行一个前置效果", LogUtType.Special); ExecutionOneEffectContent(effectInfoProxy, preEffect, gameContainerProxy); } else { allPreEffectExe = false; } } if (allPreEffectExe) { UtilityLog.Log("执行后置效果", LogUtType.Special); //遍历每一个后置效果 foreach (EffectInfo postEffect in effectInfo.postEffectEntryList) { UtilityLog.Log("执行一个后置效果", LogUtType.Special); ExecutionOneEffectContent(effectInfoProxy, postEffect, gameContainerProxy); } } effectInfo.effectInfoStage = EffectInfoStage.Finished; } //选择效果无需展示 if (effectInfo.whetherToshow == "Y") { //发送已经确认目标的效果到前台进行展示 CardEntry oneCardEntry = effectInfo.cardEntry; oneCardEntry.needShowEffectInfo = effectInfo; effectInfoProxy.effectSysItem.showEffectNum++; SendNotification(UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS, oneCardEntry, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_PUT_ONE_EFFECT); } } }
public void AskTheUserOperating(EffectInfo effectInfo, PlayerGroupProxy playerGroupProxy, QuestStageCircuitProxy questStageCircuitProxy, EffectInfoProxy effectInfoProxy, GameContainerProxy gameContainerProxy) { effectInfo.effectInfoStage = EffectInfoStage.AskTheUser; if (effectInfo.effectType == "Independent") { } else if (effectInfo.effectType == "BeforeAndAfter") { //遍历每一个前置效果 foreach (EffectInfo preEffect in effectInfo.preEffectEntryList) { if (preEffect.effectInfoStage == EffectInfoStage.AskTheUser || preEffect.effectInfoStage == EffectInfoStage.ConfirmedTarget) { preEffect.effectInfoStage = EffectInfoStage.AskTheUser; preEffect.checkCanExecution = true; bool checkOver = EffectExecution(preEffect, EffectExeType.Check, gameContainerProxy); if (!checkOver) { preEffect.checkCanExecution = false; UtilityLog.Log(preEffect.code + ":检查为不能释放", LogUtType.Special); } //判断是否是必发 if (preEffect.mustBeLaunched == "N") { //不是必发,需要用户判断 effectInfo.needChoosePreEffect = preEffect; //发送已经确认目标的效果到前台进行展示 CardEntry oneCardEntry = effectInfo.cardEntry; oneCardEntry.needShowEffectInfo = effectInfo; effectInfoProxy.effectSysItem.showEffectNum++; SendNotification(UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS, oneCardEntry, UIViewSystemEvent.UI_EFFECT_DISPLAY_SYS_ONE_EFFECT_NEED_CHOOSE_EXE); return; } else { preEffect.effectInfoStage = EffectInfoStage.AskTheUserOver; } } else { UtilityLog.LogError("逻辑错误:不应出现【用户判断】阶段前不是【宾语目标寻找结束】阶段"); } } } effectInfo.effectInfoStage = EffectInfoStage.AskTheUserOver; }
//从拼接的字符串中获取转发的NotificationName public static string GeNotificationNameForNN(string str) { string[] sArray = Regex.Split(str, "=>", RegexOptions.IgnoreCase); if (sArray.Length > 1) { return(sArray[1]); } else { UtilityLog.LogError("转发失败"); return(""); } }
//读取玩家信息 public void LoadPlayerInfo() { if (playerItem == null) { UtilityLog.LogError("playerItem is null"); } if (playerItem.shipCard != null) { LoadShipCard(playerItem.shipCard); } // LoadCardList(playerItem.cardDeck); }
//删除一个状态 public void DeleteFSMState(FSMBaseState state) { if (state == null) { UtilityLog.LogError("状态为空"); return; } if (!stateDictionary.ContainsKey(state.name)) { UtilityLog.LogError("状态在状态机中不存在"); return; } stateDictionary.Remove(state.name); }
//获取N张随机牌池的牌 public List <CardEntry> GetSameCardEntry(int num) { if (num > cardDbItem.cardEntryPool.Count) { UtilityLog.LogError("need card number too much"); return(null); } List <int> randomList = RandomUtil.GetRandom(0, cardDbItem.cardEntryPool.Count - 1, num, false); List <CardEntry> cardEntries = new List <CardEntry>(); foreach (int i in randomList) { cardEntries.Add(cardDbItem.cardEntryPool[i]); } return(cardEntries); }
//展示界面 public void ShowView(UIViewName viewName, params object[] args) { //获取界面配置 UIViewConfig config = GetConfig(viewName); if (config == null) { return; } ViewBaseView view = null; if (config.unique) { //判断是否打开了 for (int i = 0; i < viewList.Count; ++i) { if (viewList[i].config.viewName == viewName) { view = viewList[i]; break; } } //判断是否已被打开,没有打开个新的 if (view != null) { if (view.layerController == null) { UtilityLog.LogError(string.Format("Show view error: {0}, not layer", viewName)); return; } //设置参数,重新放入窗口层级控制器 // view.SetArguments(args); view.layerController.Push(view); } else { ShowViewFromCacheOrCreateNew(config, args); } } else { ShowViewFromCacheOrCreateNew(config, args); } //刷新显示、隐藏状态 UpdateViewHideState(); }
public void Action(FSMBaseSys fSMBaseSys) { //检测状态是否存在 if (!fSMBaseSys.CheckFSMState(from) || !fSMBaseSys.CheckFSMState(to)) { UtilityLog.LogError("状态在状态机中不存在"); return; } if (fSMBaseSys.nowState.name != from.name) { UtilityLog.LogError("开始状态错误"); return; } fSMBaseSys.nowState.EndState(); fSMBaseSys.nowState = from; fSMBaseSys.nowState.StartState(); }
//将一张卡从一个容器移动到另外一个容器 public bool MoveOneCardFromOldeContainerItemToNeweContainerItem(CardEntry cardEntry, string newGameContainerType) { UtilityLog.Log("【" + cardEntry.cardInfo.code + "】移动所在位置,从【" + cardEntry.gameContainerType + "】到【" + newGameContainerType + "】", LogUtType.Effect); //获取所有者 PlayerItem playerItem = cardEntry.controllerPlayerItem; //获取旧的容器类别 string oldGameContainerType = cardEntry.gameContainerType; //获取旧的容器 GameContainerItem oldGameContainerItem = GetGameContainerItemByPlayerItemAndGameContainerType(playerItem, oldGameContainerType); //旧的容器移除这张卡 oldGameContainerItem.RemoveOneCardEntry(cardEntry); cardEntry.lastGameContainerType = cardEntry.gameContainerType; //新的容器添加这张卡 AddCardByPlayerItemAndGameContainerType(playerItem, newGameContainerType, cardEntry); cardEntry.ttCardChangeGameContainerType(cardEntry); return(true); }
public List <CardEntry> GetMinionListByTargetSet(TargetSet targetSetToChoose, GameContainerProxy gameContainerProxy) { List <CardEntry> mList = new List <CardEntry>(); List <GameContainerItem> returnGameContainerItemList = gameContainerProxy.GetGameContainerItemGameContainerType("CardBattlefield"); foreach (GameContainerItem gameContainerItem in returnGameContainerItemList) { foreach (CardEntry minionCellItem in gameContainerItem.cardEntryList) { if (targetSetToChoose.checkEffectToTargetMinionCellItem(minionCellItem)) { UtilityLog.Log(" 检查了生物:" + minionCellItem.cardInfo.code, LogUtType.Special); minionCellItem.IsEffectTarget = true; mList.Add(minionCellItem); } } } return(mList); }
//打开一个新的 private ViewBaseView ShowNewView(UIViewConfig config) { if (!UIControllerViews.ContainsKey(config.viewLayer)) { UtilityLog.LogError("Show new view failed. Layer error."); return(null); } //加载 ViewBaseView view = CreateUIView(config); if (view) { //创建完毕,初始化 view.Init(); view.transform.SetParent(UIControllerViews[config.viewLayer].transform, false); view.GetComponent <RectTransform>().Normalize(); } return(view); }
//先尝试从缓存中打开,如果失败则打开一个新的 private void ShowViewFromCacheOrCreateNew(UIViewConfig config, params object[] args) { //先尝试从缓存区中读取 ViewBaseView view = GetViewFromCache(config); //缓存区内没有,打开新的 if (view == null) { view = ShowNewView(config); } if (view != null) { PushViewToLayer(view, args); } else { UtilityLog.LogError(string.Format("Show view failed -> {0}", config.viewName)); } }
//根据指定牌添加生物 public void AddOneMinionByCard(HexCoordinates index, CardEntry cardEntry) { //判断这个坐标上是否已经有生物存在 if (CheckHasCardEntryByGameContainerTypeAndHexCoordinates("CardBattlefield", index) != null) { UtilityLog.LogError("该位置已存在生物"); return; } cardEntry.dtoType = "Minion"; cardEntry.IsEffectTarget = false; cardEntry.nowIndex = index; cardEntry.cardEntryVariableAttributeMap.CreateVariableAttributeByOriginalValueAndCodeAndBetterAndAutoRestore("Atk", cardEntry.atk, true); cardEntry.cardEntryVariableAttributeMap.CreateVariableAttributeByOriginalValueAndCodeAndBetterAndAutoRestore("Def", cardEntry.def, true); AddTimeTrigger(cardEntry); SendNotification(MinionSystemEvent.MINION_VIEW, cardEntry, MinionSystemEvent.MINION_VIEW_ADD_ONE_MINION); }
//录入事件前需要先录入状态 public void AddFSMEvent(FSMEvent fSMEvent) { if (fSMEvent == null) { UtilityLog.LogError("事件为空"); return; } //检测状态是否存在 if (!CheckFSMState(fSMEvent.from) || !CheckFSMState(fSMEvent.to)) { UtilityLog.LogError("事件状态在状态机中不存在"); return; } if (eventDictionary.ContainsKey(fSMEvent.code)) { UtilityLog.LogError("事件在状态机中已存在"); return; } eventDictionary.Add(fSMEvent.code, fSMEvent); }
//根据指定界面 public void HideView(ViewBaseView view) { if (view == null) { return; } //在窗口栈中的界面都可以关闭 if (view.layerController != null) { viewList.Remove(view); view.layerController.Popup(view); SchemeViewCache(view); UpdateViewHideState(); } else { UtilityLog.LogError(string.Format("Attamp to hide a error view {0}, not in controller.", view.config.viewName)); } }
//添加一个状态 public void AddFSMState(FSMBaseState state) { if (state == null) { UtilityLog.LogError("状态为空"); return; } if (nowState == null) { //状态运行 nowState = state; nowState.StartState(); } if (stateDictionary.ContainsKey(state.name)) { UtilityLog.LogError("状态在状态机中已存在"); return; } stateDictionary.Add(state.name, state); }
//设置当前游戏模式 public void setGameModelNow(string name) { //先默认是安多尔模式 gameModelNow = this.gameModelInfoMap[name]; UtilityLog.Log("当前游戏模式:" + gameModelNow.name, LogUtType.Other); //地图模式 string arrayMode = gameModelNow.arrayMode; //地图大小 int height = gameModelNow.height; int width = gameModelNow.width; hexModelInfoNow = new HexModelInfo(width, height, arrayMode, HexModelType.Source); hexModelInfoNow.expansionVector.Add(new HexCoordinates(0, 1)); hexModelInfoNow.expansionVector.Add(new HexCoordinates(1, 0)); hexModelInfoNow.expansionVector.Add(new HexCoordinates(1, -1)); hexModelInfoNow.expansionVector.Add(new HexCoordinates(0, -1)); hexModelInfoNow.expansionVector.Add(new HexCoordinates(-1, 0)); hexModelInfoNow.expansionVector.Add(new HexCoordinates(-1, 1)); SendNotification(OrderSystemEvent.CLINET_SYS, hexModelInfoNow, OrderSystemEvent.CLINET_SYS_GMAE_MODEL_SET); }
public void ExeEffectQueue() { if (effectSysItem.effectSysItemStage == EffectSysItemStage.UnStart) { if (effectSysItem.cardEntryQueue.Count > 0) { effectSysItem.effectSysItemStage = EffectSysItemStage.Executing; effectSysItem.effectInfos = effectSysItem.effectInfosQueue.Dequeue(); effectSysItem.cardEntry = effectSysItem.cardEntryQueue.Dequeue(); UtilityLog.Log("效果系统取出了卡牌【" + effectSysItem.cardEntry.name + "】进行释放", LogUtType.Effect); //SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_FIND_OBJECT); SendNotification(EffectExecutionEvent.EFFECT_EXECUTION_SYS, null, EffectExecutionEvent.EFFECT_EXECUTION_SYS_FIND_TARGET); } else { //UtilityLog.Log("当前没有需要结算的效果"); //通知回合控制器当前堆叠已经全部执行完毕 //SendNotification(UIViewSystemEvent.UI_QUEST_TURN_STAGE, null, UIViewSystemEvent.UI_QUEST_TURN_STAGE_NEED_CHECK_END_STAGE); } } }
//增加玩家 public void AddPlayer(string playerCode, PlayerType playerType) { PlayerItem playerItem = null; if (playerType == PlayerType.HumanPlayer) { playerItem = playerGroup.AddHumanPlayer(playerCode); } else if (playerType == PlayerType.AIPlayer) { playerItem = playerGroup.AddAIPlayer(playerCode); } if (playerItem == null) { UtilityLog.LogError("玩家创建失败"); } else { AddTimeTrigger(playerItem); } }
//移除一张手牌的实例 public void RemoveOneHandCellItem(CardEntry cardEntry) { int index = -1; for (int i = 0; i < this.handCells.Count; i++) { if (this.handCells[i].uuid == cardEntry.uuid) { index = i; break; } } if (index < 0) { UtilityLog.LogError("This handCellItem index" + cardEntry.locationIndex + "is not exist"); } else { this.handCells.RemoveAt(index); } }
//读入界面 private ViewBaseView CreateUIView(UIViewConfig config) { GameObject obj = null; obj = UnityEditor.AssetDatabase.LoadAssetAtPath <GameObject>(string.Format("Assets/Resources/Prefabs/UIView/{0}.prefab", config.assetName)); if (obj != null) { obj = Instantiate(obj); } if (obj) { var viewBase = obj.GetComponent <ViewBaseView>(); return(viewBase); } else { UtilityLog.LogError(string.Format("Load view error: no view : {0}", config.assetName)); return(null); } }
//移除一张手牌的实例 public void RemoveOneCardEntry(CardEntry cardEntry) { int index = -1; for (int i = 0; i < this.cardEntryList.Count; i++) { if (this.cardEntryList[i].uuid == cardEntry.uuid) { index = i; break; } } if (index < 0) { UtilityLog.LogError("This handCellItem index" + cardEntry.locationIndex + "is not exist"); } else { cardEntry.lastGameContainerType = this.gameContainerType; this.cardEntryList.RemoveAt(index); } }
public TraitType getTraitTypeByString(string traitName) { TraitType traitType = TraitType.error; if (traitName == "supremcy") { traitType = TraitType.supremcy; } else if (traitName == "innovation") { traitType = TraitType.innovation; } else if (traitName == "polymorphism") { traitType = TraitType.polymorphism; } if (traitType == TraitType.error) { UtilityLog.LogError("找不到对应的科技类型"); } return(traitType); }