/// <summary> /// 设置属性 /// </summary> /// <param name="characterAttributes"></param> /// <param name="characterEquip"></param> public void SetAttributes(CharacterBean characterData) { characterData.GetAttributes(out CharacterAttributesBean totalAttributes, out CharacterAttributesBean selfAttributes, out CharacterAttributesBean equipAttributes); if (tvCook != null) { tvCook.text = TextHandler.Instance.manager.GetTextById(1) + ":" + selfAttributes.cook + (equipAttributes.cook == 0 ? "" : "+" + equipAttributes.cook); } if (tvSpeed != null) { tvSpeed.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + ":" + selfAttributes.speed + (equipAttributes.speed == 0 ? "" : "+" + equipAttributes.speed); } if (tvAccount != null) { tvAccount.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + ":" + selfAttributes.account + (equipAttributes.account == 0 ? "" : "+" + equipAttributes.account); } if (tvCharm != null) { tvCharm.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + ":" + selfAttributes.charm + (equipAttributes.charm == 0 ? "" : "+" + equipAttributes.charm); } if (tvForce != null) { tvForce.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + ":" + selfAttributes.force + (equipAttributes.force == 0 ? "" : "+" + equipAttributes.force); } if (tvLucky != null) { tvLucky.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky) + ":" + selfAttributes.lucky + (equipAttributes.lucky == 0 ? "" : "+" + equipAttributes.lucky); } if (characterAttributeView != null) { characterAttributeView.SetData(totalAttributes.cook, totalAttributes.speed, totalAttributes.account, totalAttributes.charm, totalAttributes.force, totalAttributes.lucky); } }
/// <summary> /// 设置速度 /// </summary> /// <param name="loyal"></param> public void SetSpeed(int speed) { if (tvSpeed != null) { tvSpeed.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + " " + speed; } }
/// <summary> /// 设置计算 /// </summary> /// <param name="loyal"></param> public void SetAccount(int account) { if (tvAccount != null) { tvAccount.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + " " + account; } }
/// <summary> /// 设置生命值 /// </summary> /// <param name="life"></param> public void SetLife(int life) { if (tvLife != null) { tvLife.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Life) + " " + life; } }
/// <summary> /// 设置忠诚 /// </summary> /// <param name="loyal"></param> public void SetLoyal(int loyal) { if (tvLoyal != null) { tvLoyal.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Loyal) + " " + loyal; } }
/// <summary> /// 设置幸运 /// </summary> /// <param name="loyal"></param> public void SetLucky(int lucky) { if (tvLucky != null) { tvLucky.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky) + " " + lucky; } }
/// <summary> /// 设置武力 /// </summary> /// <param name="loyal"></param> public void SetForce(int force) { if (tvForce != null) { tvForce.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + " " + force; } }
/// <summary> /// 设置属性 /// </summary> /// <param name="data"></param> public void SetAttributes(ItemsInfoBean data) { CptUtil.RemoveChildsByActive(objAttributeContainer); CreateItemAttributes("ui_ability_life", data.add_life, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Life), colorForAttribute); CreateItemAttributes("ui_ability_cook", data.add_cook, TextHandler.Instance.manager.GetTextById(1), colorForAttribute); CreateItemAttributes("ui_ability_speed", data.add_speed, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed), colorForAttribute); CreateItemAttributes("ui_ability_account", data.add_account, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account), colorForAttribute); CreateItemAttributes("ui_ability_charm", data.add_charm, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm), colorForAttribute); CreateItemAttributes("ui_ability_force", data.add_force, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force), colorForAttribute); CreateItemAttributes("ui_ability_lucky", data.add_lucky, AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky), colorForAttribute); if (CheckUtil.StringIsNull(data.effect)) { return; } List <EffectTypeBean> listEffectData = EffectTypeEnumTools.GetListEffectData(data.effect); //获取详情 EffectDetailsEnumTools.GetEffectDetailsForCombat(data.effect_details, out string effectPSName, out int durationForRound); if (listEffectData == null) { return; } foreach (EffectTypeBean itemData in listEffectData) { EffectTypeEnumTools.GetEffectDetails(itemData, null); string describe = itemData.effectDescribe; if (durationForRound != 0) { describe += ("\n" + string.Format(TextHandler.Instance.manager.GetTextById(502), "" + durationForRound)); } CreateItemAttributes(itemData.spIcon, describe); } }
/// <summary> /// 设置数据 /// </summary> /// <param name="cook"></param> /// <param name="speed"></param> /// <param name="account"></param> /// <param name="charm"></param> /// <param name="force"></param> public void SetData(int cook, int speed, int account, int charm, int force, int lucky) { this.cook = cook; this.speed = speed; this.account = account; this.charm = charm; this.force = force; this.lucky = lucky; if (tvCook != null) { tvCook.text = cook + " " + TextHandler.Instance.manager.GetTextById(1); } if (tvSpeed != null) { tvSpeed.text = speed + " " + AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed); } if (tvAccount != null) { tvAccount.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + " " + account; } if (tvCharm != null) { tvCharm.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + " " + charm; } if (tvForce != null) { tvForce.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + " " + force; } if (tvLucky != null) { tvLucky.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky) + " " + lucky; } StartCoroutine(CoroutineForInit()); }
/// <summary> /// 设置魅力 /// </summary> /// <param name="loyal"></param> public void SetCharm(int charm) { if (tvCharm != null) { tvCharm.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + " " + charm; } }
/// <summary> /// 设置属性 /// </summary> /// <param name="add_cook"></param> /// <param name="add_speed"></param> /// <param name="add_account"></param> /// <param name="add_charm"></param> /// <param name="add_force"></param> /// <param name="add_lucky"></param> public void SetAttribute(int add_book, int add_cook, int add_speed, int add_account, int add_charm, int add_force, int add_lucky) { if (objCook != null && add_cook == 0) { objCook.SetActive(false); } if (objSpeed != null && add_speed == 0) { objSpeed.SetActive(false); } if (objAccount != null && add_account == 0) { objAccount.SetActive(false); } if (objCharm != null && add_charm == 0) { objCharm.SetActive(false); } if (objForce != null && add_force == 0) { objForce.SetActive(false); } if (objLucky != null && add_lucky == 0) { objLucky.SetActive(false); } if (objCookBook != null && add_book == 0) { objCookBook.SetActive(false); } if (tvCook != null) { tvCook.text = TextHandler.Instance.manager.GetTextById(1) + "+" + add_cook; } if (tvSpeed != null) { tvSpeed.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + "+" + add_speed; } if (tvAccount != null) { tvAccount.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + "+" + add_account; } if (tvCharm != null) { tvCharm.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + "+" + add_charm; } if (tvForce != null) { tvForce.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + "+" + add_force; } if (tvLucky != null) { tvLucky.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky) + "+" + add_lucky; } if (tvCookBook != null) { tvCookBook.text = TextHandler.Instance.manager.GetTextById(7) + "+" + add_book; } }
/// <summary> /// 设置魅力 /// </summary> /// <param name="userCharam"></param> /// <param name="enemyCharm"></param> public void SetCharm(int userCharam, int enemyCharm) { if (tvUserCharm != null) { tvUserCharm.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + ":" + userCharam; } if (tvEnemyCharm != null) { tvEnemyCharm.text = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + ":" + enemyCharm; } }
/// <summary> /// 获取减少属性相关数据 /// </summary> /// <param name="iconDataManager"></param> /// <param name="effectTypeData"></param> /// <returns></returns> private static EffectTypeBean GetEffectDetailsForSubAttributesRate(EffectTypeBean effectTypeData) { AttributesTypeEnum attributesType = AttributesTypeEnum.Null; string iconStr = ""; switch (effectTypeData.dataType) { case EffectTypeEnum.SubLuckyRate: attributesType = AttributesTypeEnum.Lucky; iconStr = "ui_effect_sub_lucky_2"; break; case EffectTypeEnum.SubCookRate: attributesType = AttributesTypeEnum.Cook; iconStr = "ui_effect_sub_cook_2"; break; case EffectTypeEnum.SubSpeedRate: attributesType = AttributesTypeEnum.Speed; iconStr = "ui_effect_sub_speed_2"; break; case EffectTypeEnum.SubAccountRate: attributesType = AttributesTypeEnum.Account; iconStr = "ui_effect_sub_account_2"; break; case EffectTypeEnum.SubCharmRate: attributesType = AttributesTypeEnum.Charm; iconStr = "ui_effect_sub_charm_2"; break; case EffectTypeEnum.SubForceRate: attributesType = AttributesTypeEnum.Force; iconStr = "ui_effect_sub_force_2"; break; } effectTypeData.effectData = float.Parse(effectTypeData.data); string attributesName = AttributesTypeEnumTools.GetAttributesName(attributesType); effectTypeData.effectDescribe = string.Format(TextHandler.Instance.manager.GetTextById(532), effectTypeData.effectData * 100 + "", attributesName); effectTypeData.spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(iconStr); return(effectTypeData); }
/// <summary> /// 获取增加属性相关数据 /// </summary> /// <param name="iconDataManager"></param> /// <param name="effectTypeData"></param> /// <returns></returns> private static EffectTypeBean GetEffectDetailsForAddAttributes(EffectTypeBean effectTypeData) { AttributesTypeEnum attributesType = AttributesTypeEnum.Null; string iconStr = ""; switch (effectTypeData.dataType) { case EffectTypeEnum.AddLucky: attributesType = AttributesTypeEnum.Lucky; iconStr = "ui_effect_lucky_1"; break; case EffectTypeEnum.AddCook: attributesType = AttributesTypeEnum.Cook; iconStr = "ui_effect_cook_1"; break; case EffectTypeEnum.AddSpeed: attributesType = AttributesTypeEnum.Speed; iconStr = "ui_effect_speed_1"; break; case EffectTypeEnum.AddAccount: attributesType = AttributesTypeEnum.Account; iconStr = "ui_effect_account_1"; break; case EffectTypeEnum.AddCharm: attributesType = AttributesTypeEnum.Charm; iconStr = "ui_effect_charm_1"; break; case EffectTypeEnum.AddForce: attributesType = AttributesTypeEnum.Force; iconStr = "ui_effect_force_1"; break; } effectTypeData.effectData = float.Parse(effectTypeData.data); string attributesName = AttributesTypeEnumTools.GetAttributesName(attributesType); effectTypeData.effectDescribe = string.Format(TextHandler.Instance.manager.GetTextById(505), effectTypeData.data, attributesName); effectTypeData.spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(iconStr); return(effectTypeData); }
private static EffectTypeBean GetEffectDetailsForDamageRateForAttributes(EffectTypeBean effectTypeData, Sprite spRemark) { AttributesTypeEnum attributesType = AttributesTypeEnum.Null; switch (effectTypeData.dataType) { case EffectTypeEnum.DamageRateForLucky: attributesType = AttributesTypeEnum.Lucky; break; case EffectTypeEnum.DamageRateForCook: attributesType = AttributesTypeEnum.Cook; break; case EffectTypeEnum.DamageRateForSpeed: attributesType = AttributesTypeEnum.Speed; break; case EffectTypeEnum.DamageRateForAccount: attributesType = AttributesTypeEnum.Account; break; case EffectTypeEnum.DamageRateForCharm: attributesType = AttributesTypeEnum.Charm; break; case EffectTypeEnum.DamageRateForForce: attributesType = AttributesTypeEnum.Force; break; } effectTypeData.effectData = float.Parse(effectTypeData.data); string attibutesName = AttributesTypeEnumTools.GetAttributesName(attributesType); effectTypeData.effectDescribe = string.Format(TextHandler.Instance.manager.GetTextById(521), attibutesName, effectTypeData.data); effectTypeData.colorIcon = Color.red; effectTypeData.spIconRemark = spRemark; effectTypeData.spIcon = AttributesTypeEnumTools.GetAttributesIcon(attributesType); return(effectTypeData); }
/// <summary> /// 创建胜利数据 /// </summary> private void CreateWinItems() { CptUtil.RemoveChildsByActive(objResultContainer.transform); if (miniGameData == null) { return; } //通常列表 string reasonStr = ""; GameObject objReasonItem = Instantiate(objResultContainer, objResultWinModel); ItemMiniGameEndResultWinCpt itemReasonWin = objReasonItem.GetComponent <ItemMiniGameEndResultWinCpt>(); switch (miniGameData.gameReason) { case MiniGameReasonEnum.Improve: //晋升成功 reasonStr = TextHandler.Instance.manager.GetTextById(43); //数据添加 Sprite attributeIcon = null; string attributeRewardContent = ""; foreach (MiniGameCharacterBean miniGameCharacterData in miniGameData.listUserGameData) { switch (miniGameData.gameType) { case MiniGameEnum.Cooking: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Cook) + " +5"; miniGameCharacterData.characterData.baseInfo.chefInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Barrage: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + " +5"; miniGameCharacterData.characterData.baseInfo.waiterInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Account: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + " +5"; miniGameCharacterData.characterData.baseInfo.accountantInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Debate: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + " +5"; miniGameCharacterData.characterData.baseInfo.accostInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Combat: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + " +5"; miniGameCharacterData.characterData.baseInfo.beaterInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; } } //创建属性奖励 attributeIcon = IconDataHandler.Instance.manager.GetIconSpriteByName("keyboard_button_up_1"); CreateWinReward(attributeIcon, null, attributeRewardContent); break; case MiniGameReasonEnum.Fight: //决斗胜利 reasonStr = TextHandler.Instance.manager.GetTextById(44); break; case MiniGameReasonEnum.Recruit: //决斗胜利 reasonStr = TextHandler.Instance.manager.GetTextById(45); break; default: reasonStr = TextHandler.Instance.manager.GetTextById(901); break; } itemReasonWin.SetContent(reasonStr); itemReasonWin.SetIcon(IconDataHandler.Instance.manager.GetIconSpriteByName("text_win_1")); //添加奖励 RewardTypeEnumTools.CompleteReward(miniGameData.GetListUserCharacterData(), miniGameData.listReward); //遍历奖励列表 foreach (var itemReward in miniGameData.listReward) { CreateWinReward(itemReward.spRewardIcon, itemReward.workerCharacterData, itemReward.rewardDescribe); } }
private void Start() { if (pbName != null) { pbName.SetContent(TextHandler.Instance.manager.GetTextById(61)); } if (pbPrice != null) { pbPrice.SetContent(TextHandler.Instance.manager.GetTextById(11002)); } if (pbLoyal != null) { pbLoyal.SetContent(TextHandler.Instance.manager.GetTextById(11003)); } if (pbCook != null) { pbCook.SetContent(AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Cook)); } if (pbSpeed != null) { pbSpeed.SetContent(AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed)); } if (pbAccount != null) { pbAccount.SetContent(AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account)); } if (pbCharm != null) { pbCharm.SetContent(AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm)); } if (pbForce != null) { pbForce.SetContent(AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force)); } if (pbLucky != null) { pbLucky.SetContent(AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Lucky)); } if (wvChef != null) { wvChef.SetCallBack(this); } if (wvWaiterForSend != null) { wvWaiterForSend.SetCallBack(this); } if (wvWaiterForCleanTable != null) { wvWaiterForCleanTable.SetCallBack(this); } if (wvWaiterForCleanBed != null) { wvWaiterForCleanBed.SetCallBack(this); } if (wvAccounting != null) { wvAccounting.SetCallBack(this); } if (wvAccostForSolicit != null) { wvAccostForSolicit.SetCallBack(this); } if (wvAccostForGuide != null) { wvAccostForGuide.SetCallBack(this); } if (wvBeater != null) { wvBeater.SetCallBack(this); } if (btEquip != null) { btEquip.onClick.AddListener(OpenEquipUI); } if (btDetails != null) { btDetails.onClick.AddListener(OpenDeitalsUI); } if (btFire != null) { btFire.onClick.AddListener(FireWorker); } if (btGift != null) { btGift.onClick.AddListener(SendGift); } }
public void Submit(DialogView dialogView, DialogBean dialogBean) { GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); //支付金钱 gameData.PayMoney(levelData.price_l, levelData.price_m, levelData.price_s); //扣除时间 int preGameTime = int.Parse(levelData.mark); //扣除时间 GameTimeHandler.Instance.AddHour(preGameTime); //如果有研究菜谱 菜谱增加经验 GameDataHandler.Instance.AddTimeProcess(preGameTime * 60); //判断玩哪个游戏 MiniGameBaseBean miniGameData = null; switch (workerType) { case WorkerEnum.Chef: miniGameData = InitChefGame(); break; case WorkerEnum.Waiter: //设置弹幕游戏数据 miniGameData = InitWaiterGame(); break; case WorkerEnum.Accountant: //设置算账游戏 miniGameData = InitAccountantGame(); break; case WorkerEnum.Accost: //设置辩论游戏 miniGameData = InitAccostGame(); break; case WorkerEnum.Beater: miniGameData = InitBeaterGame(); break; default: break; } miniGameData.preGameTime = preGameTime; miniGameData.gameReason = MiniGameReasonEnum.Improve; if (dialogBean.dialogPosition == 0) { //设置竞技场数据 GameCommonInfo.SetArenaPrepareData(miniGameData); //保存之前的位置 GameCommonInfo.ScenesChangeData.beforeUserPosition = GameControlHandler.Instance.manager.GetControl <BaseControl>(ControlEnum.Normal).transform.position; //跳转到竞技场 GameScenesHandler.Instance.ChangeScene(ScenesEnum.GameArenaScene); } else { bool isWin = characterData.CalculationGuildSendWin(miniGameData.gameType); if (isWin) { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7021)); AudioHandler.Instance.PlaySound(AudioSoundEnum.Reward); //完成奖励 RewardTypeEnumTools.CompleteReward(miniGameData.GetListUserCharacterData(), miniGameData.listReward); //数据添加 Sprite attributeIcon = IconDataHandler.Instance.manager.GetIconSpriteByName("keyboard_button_up_1"); string attributeRewardContent = ""; foreach (MiniGameCharacterBean miniGameCharacterData in miniGameData.listUserGameData) { switch (miniGameData.gameType) { case MiniGameEnum.Cooking: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Cook) + " +5"; miniGameCharacterData.characterData.baseInfo.chefInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Barrage: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Speed) + " +5"; miniGameCharacterData.characterData.baseInfo.waiterInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Account: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Account) + " +5"; miniGameCharacterData.characterData.baseInfo.accountantInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Debate: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Charm) + " +5"; miniGameCharacterData.characterData.baseInfo.accostInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; case MiniGameEnum.Combat: attributeRewardContent = AttributesTypeEnumTools.GetAttributesName(AttributesTypeEnum.Force) + " +5"; miniGameCharacterData.characterData.baseInfo.beaterInfo.LevelUp(miniGameCharacterData.characterData.attributes); break; } } ToastHandler.Instance.ToastHint(attributeIcon, attributeRewardContent); //刷新UI ((UITownGuildImprove)uiComponent).RefreshUI(); } else { ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7022)); AudioHandler.Instance.PlaySound(AudioSoundEnum.Passive); } } }