public GameObject CreateEffectUI(string EffectKey, IUIObject UIObject) { GameObject gameObject = EffectDefine.Attach(string.Format("UI_{0}", EffectKey)); NrTSingleton <UIDataManager> .Instance.EffectLocateUIPos(gameObject, UIObject); this.AddEffect(EffectKey, gameObject); return(gameObject); }
public GameObject CreateEffectUI(string EffectKey, Vector2 ScreenPos, NkEffectUnit.DeleteCallBack DelCallBack) { GameObject gameObject = EffectDefine.Attach(string.Format("UI_{0}", EffectKey)); this.AddEffect(EffectKey, gameObject, DelCallBack); gameObject.transform.position = NrTSingleton <UIDataManager> .Instance.GetEffectUIPos(ScreenPos); return(gameObject); }
public void SwapTurn(bool _PlayerTurn, float _Time) { this.m_PlayerTurn = _PlayerTurn; this.m_TurnTime = _Time; this.m_TurnTimeEnd = Time.realtimeSinceStartup + this.m_TurnTime; this.m_TurnSwapTime = Time.realtimeSinceStartup; this.SetVisibleFlag(false); Vector2 screenPos = new Vector2(GUICamera.width / 2f, GUICamera.height / 2f); if (EffectDefine.IsValidParent(this.m_EffectTurnMyAlly) && this.m_PlayerTurn) { this.m_EffectTurnMyAlly = NrTSingleton <NkEffectManager> .Instance.CreateEffectUI("FX_PLAYER_PHASE", screenPos, new NkEffectUnit.DeleteCallBack(this.TurnEffectDeleteCallBack)); } if (EffectDefine.IsValidParent(this.m_EffectTurnEnemyAlly) && !this.m_PlayerTurn) { this.m_EffectTurnEnemyAlly = NrTSingleton <NkEffectManager> .Instance.CreateEffectUI("FX_ENEMY_PHASE", screenPos, new NkEffectUnit.DeleteCallBack(this.TurnEffectDeleteCallBack)); } GameObject gameObject; GameObject gameObject2; if (this.m_PlayerTurn) { gameObject = this.m_EffectTurnMyAlly; gameObject2 = this.m_EffectTurnEnemyAlly; } else { gameObject = this.m_EffectTurnEnemyAlly; gameObject2 = this.m_EffectTurnMyAlly; } if (null != gameObject) { Vector2 screenPos2 = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)); gameObject.transform.position = base.GetEffectUIPos(screenPos2); gameObject.layer = TsLayer.GUI; gameObject.SetActive(true); Animation componentInChildren = gameObject.GetComponentInChildren <Animation>(); if (componentInChildren != null) { componentInChildren.cullingType = AnimationCullingType.AlwaysAnimate; } } if (null != gameObject2) { Vector2 screenPos3 = new Vector2((float)(Screen.width / 2), (float)(-(float)Screen.height / 2)); gameObject2.transform.position = base.GetEffectUIPos(screenPos3); gameObject2.layer = TsLayer.GUI; gameObject2.SetActive(false); } NrSound.ImmedatePlay("UI_SFX", "BATTLE", (!_PlayerTurn) ? "YOURTURN" : "MYTURN"); }
public void ShowHiddenTreasureMonsterDie() { Vector2 screenPos = new Vector2(GUICamera.width / 2f, GUICamera.height / 2f); if (EffectDefine.IsValidParent(this.m_EffectHiddenTreasureMonsterDie)) { this.m_EffectHiddenTreasureMonsterDie = NrTSingleton <NkEffectManager> .Instance.CreateEffectUI("FX_UI_BIGTREASUREBOX", screenPos, new NkEffectUnit.DeleteCallBack(this.HiddenTreasureMonsterDieEffect)); this.m_EffectHiddenTreasureMonsterDie.layer = TsLayer.GUI; } else { this.m_EffectHiddenTreasureMonsterDie.SetActive(true); this.m_EffectHiddenTreasureMonsterDie.layer = TsLayer.GUI; } }
/// <summary> /// 获得效果定义 /// </summary> /// <param name="worksheet"></param> /// <param name="rowCount"></param> /// <returns></returns> private static EffectDefine GetEffectDefine(dynamic worksheet, ref int rowCount) { EffectDefine effect = new EffectDefine(); //当前行是第一效果的标题栏 rowCount++; //当前行是第一效果的内容栏 effect.AbliltyPosPicker.EffictTargetSelectMode = CSharpUtility.GetEnum <CardUtility.目标选择模式枚举>(worksheet.Cells(rowCount, 3).Text, CardUtility.目标选择模式枚举.用选择); effect.AbliltyPosPicker.EffectTargetSelectDirect = CSharpUtility.GetEnum <CardUtility.目标选择方向枚举>(worksheet.Cells(rowCount, 4).Text, CardUtility.目标选择方向枚举.双方); effect.AbliltyPosPicker.EffectTargetSelectRole = CSharpUtility.GetEnum <CardUtility.目标选择角色枚举>(worksheet.Cells(rowCount, 5).Text, CardUtility.目标选择角色枚举.英雄); effect.AbliltyPosPicker.EffectTargetSelectCondition = worksheet.Cells(rowCount, 6).Text; effect.EffectCount = CSharpUtility.GetInt(worksheet.Cells(rowCount, 7).Text); effect.效果条件 = worksheet.Cells(rowCount, 8).Text; effect.TrueAtomicEffect.描述 = worksheet.Cells(rowCount, 9).Text; effect.TrueAtomicEffect.AtomicEffectType = CSharpUtility.GetEnum <AtomicEffectDefine.AtomicEffectEnum>(worksheet.Cells(rowCount, 10).Text, AtomicEffectDefine.AtomicEffectEnum.未定义); for (int i = 11; i < 15; i++) { if (string.IsNullOrEmpty(worksheet.Cells(rowCount, i).Text)) { break; } effect.TrueAtomicEffect.InfoArray.Add((worksheet.Cells(rowCount, i).Text)); } if (effect.效果条件 != CardUtility.strIgnore) { rowCount++; //当前行是第二效果的标题栏 rowCount++; //当前行是第二效果的内容栏 effect.FalseAtomicEffect.描述 = worksheet.Cells(rowCount, 9).Text; effect.FalseAtomicEffect.AtomicEffectType = CSharpUtility.GetEnum <AtomicEffectDefine.AtomicEffectEnum>(worksheet.Cells(rowCount, 10).Text, AtomicEffectDefine.AtomicEffectEnum.未定义); for (int i = 11; i < 15; i++) { if (string.IsNullOrEmpty(worksheet.Cells(rowCount, i).Text)) { break; } effect.FalseAtomicEffect.InfoArray.Add((worksheet.Cells(rowCount, i).Text)); } } return(effect); }
/// <summary> /// 运行单一效果 /// </summary> /// <param name="game"></param> /// <param name="Ability"></param> /// <param name="Result"></param> private static void RunEffect(ActionStatus game, EffectDefine SingleEffect, List <string> Result) { switch (SingleEffect.TrueAtomicEffect.AtomicEffectType) { case AtomicEffectDefine.AtomicEffectEnum.卡牌: case AtomicEffectDefine.AtomicEffectEnum.水晶: case AtomicEffectDefine.AtomicEffectEnum.召唤: case AtomicEffectDefine.AtomicEffectEnum.武器: Result.AddRange(RunGameSystemEffect(game, SingleEffect.TrueAtomicEffect, SingleEffect.AbliltyPosPicker)); break; case AtomicEffectDefine.AtomicEffectEnum.控制: Result.AddRange(ControlEffect.RunEffect(game, SingleEffect.AbliltyPosPicker.SelectedPos.ToString())); break; case AtomicEffectDefine.AtomicEffectEnum.未定义: break; default: Result.AddRange(Effecthandler.RunSingleEffect(SingleEffect, game, ActionStatus.RandomSeed)); break; } }
/// <summary> /// 使用法术 /// </summary> /// <param name="card"></param> /// <param name="ConvertPosDirect">对象方向转换</param> public List <String> UseAbility(Card.AbilityCard card, Boolean ConvertPosDirect) { List <String> Result = new List <string>(); //法术伤害 if (MySelf.RoleInfo.BattleField.AbilityEffect != 0) { //法术强度本意是增加法术卡的总伤。以奥术飞弹为例,法术强度+1会令奥术飞弹多1发伤害,而非单发伤害+1。法术强度不影响治疗效果。 switch (card.CardAbility.FirstAbilityDefine.AbilityEffectType) { case EffectDefine.AbilityEffectEnum.攻击: if (card.CardAbility.FirstAbilityDefine.StandardEffectCount == 1) { card.CardAbility.FirstAbilityDefine.ActualEffectPoint = card.CardAbility.FirstAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect; } else { card.CardAbility.FirstAbilityDefine.ActualEffectCount = card.CardAbility.FirstAbilityDefine.StandardEffectCount + MySelf.RoleInfo.BattleField.AbilityEffect; } break; case EffectDefine.AbilityEffectEnum.回复: card.CardAbility.FirstAbilityDefine.ActualEffectPoint = card.CardAbility.FirstAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect; break; } if (card.CardAbility.SecondAbilityDefine.AbilityEffectType != EffectDefine.AbilityEffectEnum.未定义) { switch (card.CardAbility.SecondAbilityDefine.AbilityEffectType) { case EffectDefine.AbilityEffectEnum.攻击: if (card.CardAbility.SecondAbilityDefine.StandardEffectCount == 1) { card.CardAbility.SecondAbilityDefine.ActualEffectPoint = card.CardAbility.SecondAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect; } else { card.CardAbility.SecondAbilityDefine.ActualEffectCount = card.CardAbility.SecondAbilityDefine.StandardEffectCount + MySelf.RoleInfo.BattleField.AbilityEffect; } break; case EffectDefine.AbilityEffectEnum.回复: card.CardAbility.SecondAbilityDefine.ActualEffectPoint = card.CardAbility.SecondAbilityDefine.StandardEffectPoint + MySelf.RoleInfo.BattleField.AbilityEffect; break; } } } Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果; if (card.CardAbility.IsNeedSelect()) { PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description); if (PickEffectResult == CardUtility.PickEffect.取消) { return(new List <string>()); } } var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果); for (int i = 0; i < SingleEffectList.Count; i++) { Card.CardUtility.TargetPosition Pos = new CardUtility.TargetPosition(); var singleEff = SingleEffectList[i]; singleEff.StandardEffectCount = 1; if (singleEff.IsNeedSelectTarget()) { Pos = GetSelectTarget(singleEff.EffectTargetSelectDirect, singleEff.EffectTargetSelectRole, false); //取消处理 if (Pos.Postion == -1) { return(new List <string>()); } } else { if (ConvertPosDirect) { switch (singleEff.EffectTargetSelectDirect) { case CardUtility.TargetSelectDirectEnum.本方: singleEff.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.对方; break; case CardUtility.TargetSelectDirectEnum.对方: singleEff.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.本方; break; case CardUtility.TargetSelectDirectEnum.双方: break; default: break; } } } Result.AddRange(EffectDefine.RunSingleEffect(singleEff, this, Pos, Seed)); Seed++; //每次原子操作后进行一次清算 //将亡语效果也发送给对方 Result.AddRange(Settle()); } return(Result); }
/// <summary> /// 使用法术 /// </summary> /// <param name="card"></param> /// <param name="ConvertPosDirect">对象方向转换</param> public List <String> UseAbility(Card.AbilityCard card, Boolean ConvertPosDirect) { List <String> Result = new List <string>(); //法术伤害 if (MySelf.RoleInfo.BattleField.AbilityEffect != 0) { card.JustfyEffectPoint(MySelf.RoleInfo.BattleField.AbilityEffect); } Card.CardUtility.PickEffect PickEffectResult = CardUtility.PickEffect.第一效果; if (card.CardAbility.IsNeedSelect()) { PickEffectResult = PickEffect(card.CardAbility.FirstAbilityDefine.Description, card.CardAbility.SecondAbilityDefine.Description); if (PickEffectResult == CardUtility.PickEffect.取消) { return(new List <string>()); } } var SingleEffectList = card.CardAbility.GetSingleEffectList(PickEffectResult == CardUtility.PickEffect.第一效果); //Pos放在循环外部,这样的话,达到继承的效果 Card.CardUtility.TargetPosition TargetPosInfo = new CardUtility.TargetPosition(); for (int i = 0; i < SingleEffectList.Count; i++) { var singleEffect = SingleEffectList[i]; singleEffect.StandardEffectCount = 1; if (singleEffect.IsNeedSelectTarget()) { TargetPosInfo = GetSelectTarget(singleEffect.SelectOpt, false); //取消处理 if (TargetPosInfo.Postion == -1) { return(new List <string>()); } } else { if (ConvertPosDirect) { switch (singleEffect.SelectOpt.EffectTargetSelectDirect) { case CardUtility.TargetSelectDirectEnum.本方: singleEffect.SelectOpt.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.对方; break; case CardUtility.TargetSelectDirectEnum.对方: singleEffect.SelectOpt.EffectTargetSelectDirect = CardUtility.TargetSelectDirectEnum.本方; break; case CardUtility.TargetSelectDirectEnum.双方: break; default: break; } } } Result.AddRange(EffectDefine.RunSingleEffect(singleEffect, this, TargetPosInfo, Seed)); Seed++; //每次原子操作后进行一次清算 //将亡语效果也发送给对方 Result.AddRange(Settle()); } return(Result); }
/// <summary> /// 运行效果 /// </summary> /// <param name="game"></param> /// <param name="actField"></param> private static void RunNormalEffect(GameManager game, string[] actField) { //ATTACK#ME#POS#AP //Me代表对方 YOU代表自己,必须反过来 IEffectHandler handler = new AttackEffect(); EffectDefine SingleEffect = new EffectDefine(); switch (actField[0]) { case Card.Server.ActionCode.strAttack: handler = new AttackEffect(); SingleEffect.ActualEffectPoint = int.Parse(actField[3]); break; case Card.Server.ActionCode.strHealth: handler = new HealthEffect(); SingleEffect.ActualEffectPoint = int.Parse(actField[3]); if (actField.Length == 5) { SingleEffect.AdditionInfo = actField[4]; } break; case Card.Server.ActionCode.strStatus: handler = new StatusEffect(); SingleEffect.AdditionInfo = actField[3]; break; case Card.Server.ActionCode.strPoint: handler = new PointEffect(); SingleEffect.AdditionInfo = actField[3]; SingleEffect.StandardEffectPoint = int.Parse(actField[4]); break; case Card.Server.ActionCode.strTransform: handler = new TransformEffect(); SingleEffect.AdditionInfo = actField[3]; break; } if (actField[1] == CardUtility.strYou) { switch (int.Parse(actField[2])) { case BattleFieldInfo.HeroPos: handler.DealHero(game, SingleEffect, true); break; case BattleFieldInfo.AllPos: for (int i = 0; i < game.MyInfo.BattleField.MinionCount; i++) { handler.DealMinion(game, SingleEffect, true, i); } break; default: handler.DealMinion(game, SingleEffect, true, int.Parse(actField[2]) - 1); break; } } else { switch (int.Parse(actField[2])) { case BattleFieldInfo.HeroPos: handler.DealHero(game, SingleEffect, false); break; case BattleFieldInfo.AllPos: for (int i = 0; i < game.YourInfo.BattleField.MinionCount; i++) { handler.DealMinion(game, SingleEffect, false, i); } break; default: handler.DealMinion(game, SingleEffect, false, int.Parse(actField[2]) - 1); break; } } }
public void SetChallengeCount(int nCount, bool bBoss, int[] nMonsterKind) { Vector2 screenPos = new Vector2(GUICamera.width / 2f, GUICamera.height / 2f); if (EffectDefine.IsValidParent(this.m_EffectBattleChallenge)) { this.m_EffectBattleChallenge = NrTSingleton <NkEffectManager> .Instance.CreateEffectUI("FX_BATTLE_CHALLENGE", screenPos, new NkEffectUnit.DeleteCallBack(this.ChallengeEffectDeleteCallBack)); } else { this.m_EffectBattleChallenge.SetActive(false); this.m_EffectBattleChallenge.layer = TsLayer.GUI; } Transform child = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_text"); Transform child2 = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_final"); Transform child3 = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_challenge"); Transform child4 = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, "fx_bonus"); GameObject gameObject = null; GameObject gameObject2 = null; GameObject gameObject3 = null; if (child2 != null) { gameObject = child2.gameObject; } if (child4 != null) { gameObject3 = child4.gameObject; } if (child != null) { GameObject gameObject4 = child.gameObject; if (gameObject4 != null) { MeshFilter component = gameObject4.GetComponent <MeshFilter>(); Vector2[] array = new Vector2[component.mesh.uv.Length]; if (component != null) { if (Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_MYTHRAID) { Texture2D texture = NrTSingleton <UIImageBundleManager> .Instance.GetTexture(this.m_strText); if (component != null) { array[0].x = 0f; array[0].y = 1f; array[1].x = 1f; array[1].y = 1f; array[2].x = 0f; array[2].y = 0f; array[3].x = 1f; array[3].y = 0f; component.mesh.uv = array; } Material material = new Material(Shader.Find("Transparent/Vertex Colored" + NrTSingleton <UIDataManager> .Instance.AddFilePath)); if (null != gameObject4.renderer && null != material) { gameObject4.renderer.sharedMaterial = material; } if (null != texture) { material.mainTexture = texture; } else { CustomMonsterProtriteInfo customMonsterProtriteInfo = new CustomMonsterProtriteInfo(); customMonsterProtriteInfo.m_goAniObject = gameObject4; customMonsterProtriteInfo.m_Material = gameObject4.renderer.sharedMaterial; customMonsterProtriteInfo.m_szImageKey = this.m_strText; string str = string.Format("{0}", "UI/mythicraid/" + this.m_strText + NrTSingleton <UIDataManager> .Instance.AddFilePath); WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, NkBundleCallBack.UIBundleStackName); wWWItem.SetItemType(ItemType.USER_ASSETB); wWWItem.SetCallback(new PostProcPerItem(this.SetBundleImage), customMonsterProtriteInfo); TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true); } } else if (nCount > 1) { for (int i = 0; i < array.Length; i++) { array[i] = component.mesh.uv[i]; Vector2[] expr_360_cp_0 = array; int expr_360_cp_1 = i; expr_360_cp_0[expr_360_cp_1].y = expr_360_cp_0[expr_360_cp_1].y - this.m_fBattleContinueEffectUV; } if (component != null) { component.mesh.uv = array; } } } } if (bBoss) { if (nCount < 100) { if (gameObject != null) { if (child3.gameObject != null) { child3.gameObject.SetActive(false); } if (gameObject3 != null) { gameObject3.SetActive(false); } gameObject.SetActive(true); Animation component2 = gameObject.GetComponent <Animation>(); if (component2 != null) { Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + component2.clip.length + 0.1f; } else { Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + 2f; } NrSound.ImmedatePlay("UI_SFX", "BATTLE", "BATTLE-CONTINUE-BOSS"); if (Battle.BATTLE != null) { Battle.BATTLE.PlayBossBGM(); } } } else if (nCount >= 100 && gameObject3 != null) { if (child3.gameObject != null) { child3.gameObject.SetActive(false); } if (gameObject != null) { gameObject.SetActive(false); } gameObject3.SetActive(true); Animation component3 = gameObject3.GetComponent <Animation>(); if (component3 != null) { Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + component3.clip.length + 0.1f; } else { Battle.BATTLE.m_fContinueBattleWaitTime = Time.realtimeSinceStartup + 2f; } NrSound.ImmedatePlay("UI_SFX", "BATTLE", "HIDDEN_BONUS"); if (Battle.BATTLE != null) { Battle.BATTLE.PlayBossBGM(); } } } else { child3.gameObject.SetActive(false); gameObject2 = child3.gameObject; if (gameObject != null) { gameObject.SetActive(false); } if (gameObject3 != null) { gameObject3.SetActive(false); } NrSound.ImmedatePlay("UI_SFX", "BATTLE", "BATTLE-CONTINUE"); } } if (!bBoss) { for (int j = 0; j < 6; j++) { NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(nMonsterKind[j]); string strName = string.Empty; string text = string.Empty; eCharImageType type; if (j == 0) { strName = string.Format("fx_boss", new object[0]); if (charKindInfo != null) { if (UIDataManager.IsUse256Texture()) { text = charKindInfo.GetPortraitFile1(-1, string.Empty) + "_256"; } else { text = charKindInfo.GetPortraitFile1(-1, string.Empty) + "_512"; } } type = eCharImageType.LARGE; } else { strName = string.Format("fx_enemy0{0}", j.ToString()); if (charKindInfo != null) { text = charKindInfo.GetPortraitFile1(-1, string.Empty) + "_64"; } type = eCharImageType.SMALL; } Transform child5 = NkUtil.GetChild(this.m_EffectBattleChallenge.transform, strName); if (child5 != null) { GameObject gameObject5 = child5.gameObject; if (null != gameObject5) { if (charKindInfo == null) { gameObject5.SetActive(false); } else { gameObject5.SetActive(true); Renderer component4 = gameObject5.GetComponent <Renderer>(); if (component4 != null) { Material material2 = component4.material; if (null != material2) { if (null == NrTSingleton <UIImageBundleManager> .Instance.GetTexture(text)) { CustomMonsterProtriteInfo customMonsterProtriteInfo2 = new CustomMonsterProtriteInfo(); customMonsterProtriteInfo2.m_goAniObject = gameObject2; customMonsterProtriteInfo2.m_Material = material2; customMonsterProtriteInfo2.m_szImageKey = text; NrTSingleton <UIImageBundleManager> .Instance.RequestCharImageCustomParam(text, type, new PostProcPerItem(this.SetBundleImage), customMonsterProtriteInfo2); } else { material2.mainTexture = NrTSingleton <UIImageBundleManager> .Instance.GetTexture(text); gameObject2.SetActive(true); } } } } } } } } Vector2 screenPos2 = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)); this.m_EffectBattleChallenge.transform.position = base.GetEffectUIPos(screenPos2); this.m_EffectBattleChallenge.SetActive(true); this.m_nCurrentContinueCount = nCount; }
/// <summary> /// 初始化[未被使用] /// </summary> public void Init() { MainAbilityDefine = new EffectDefine(); AppendAbilityDefine = new EffectDefine(); }