protected void HandleMonsterIcon(MonsterInfo info) { if (info != null) { AtlasHelper.SetShared(m_portraitItem.portrait, info.avatar); } }
private void SetUnionIntegral() { m_unionHint.gameObject.SetActive(false); m_unionShow.gameObject.SetActive(false); if (modulePlayer.roleInfo.leagueID != 0) { var info = ConfigManager.Find <PropItemInfo>(o => o.itemType == PropType.BordGrade); if (info) { AtlasHelper.SetItemIcon(m_unionIcon, info); } var keyStr = "unionRank" + modulePlayer.id_; bool firstOpen = moduleWelfare.FrirstOpen(keyStr, false); if (moduleUnion.m_selfInter == null) { return; } if (firstOpen && moduleUnion.m_selfInter.intergl > 0) { m_unionHint.gameObject.SetActive(true); } if (moduleUnion.m_selfInter != null) { m_unionShow.gameObject.SetActive(true); m_unionScore.text = moduleUnion.m_selfInter.intergl.ToString(); } } }
private void UpdateNpcIcon(Image img, PDatingDivinationResultData data, Module_Npc.NpcMessage npc) { if (npc == null) { return; } AtlasHelper.SetNpcDateInfo(img, npc.icon); }
/// <summary> /// 设置头像 avatar 到目标对象 /// 目标对象应当是一个 UI 元素 /// 注意:如果头像加载失败并且未指定性别,头像将显示空白 /// </summary> /// <param name="o">要显示头像的目标对象</param> /// <param name="avatar">头像</param> /// <param name="useNativeSize">是否使用原始头像大小</param> /// <param name="gender">性别 可选,主要用于头像加载失败时确定男性还是女性默认头像</param> public static void SetAvatar(GameObject o, string avatar, bool useNativeSize = false, int gender = -1) { if (!o) { return; } if (string.IsNullOrEmpty(avatar)) { var dt = gender < 0 ? null : gender == 0 ? defaultFemale : defaultMale; AtlasHelper.SetAvatar(o, dt); return; } var cached = m_cachedAvatars.Get(avatar); if (cached) { UIDynamicImage.LoadImageCreated(o, avatar, cached, useNativeSize); return; } var fp = LocalFilePath.AVATAR + "/" + avatar + ".avatar"; cached = Util.LoadImage(fp); if (cached) { m_cachedAvatars.Set(avatar, cached); UIDynamicImage.LoadImageCreated(o, avatar, cached, useNativeSize); return; } var url = URLs.avatar + avatar + ".png"; UIDynamicImage.LoadImage(o, url, (di, t) => { if (!t) { if (di && gender > -1) { AtlasHelper.SetAvatar(di.gameObject, gender == 0 ? defaultFemale : defaultMale); } return; } m_cachedAvatars.Set(avatar, t); var data = UIDynamicImage.RemoveCache(url, false); if (data != null) { var hash = data.GetMD5(); if ((fp = Util.SaveFile(fp, data)) != null) { HashListFile.ReplaceHashListFile(hashFileName, avatar, hash); } } }, useNativeSize); }
private void SetItemData(Transform node, PShopItem data) { if (data == null) { return; } PropItemInfo psi = ConfigManager.Get <PropItemInfo>(data.itemTypeId); if (psi == null) { return; } Image icon = node.Find("icon").GetComponent <Image>(); Text orderName = node.Find("title").GetComponent <Text>(); Image priceIcon = node.Find("consume/number/icon").GetComponent <Image>(); Text price = node.Find("consume/number").GetComponent <Text>(); Image newMark = node.Find("newInfo").GetComponent <Image>(); Button btnBuy = node.Find("bug_Btn").GetComponent <Button>(); Text textBtnBuy = node.Find("bug_Btn/buy_Txt").GetComponent <Text>(); Text textdesc = node.Find("des").GetComponent <Text>(); Util.SetText(textBtnBuy, ConfigText.GetDefalutString(TextForMatType.NpcDatingRest, 1)); Util.SetText(textdesc, psi.desc); //菜品描述 Util.SetText(orderName, psi.itemNameId); AtlasHelper.SetItemIcon(icon, psi); //菜品图标 PropItemInfo itemInfo = ConfigManager.Get <PropItemInfo>(data.currencyType); AtlasHelper.SetItemIcon(priceIcon, itemInfo);//设置货币的icon string strPrice = "×" + data.currencyNum; //如果是免费的,则显示免费字样 priceIcon.SafeSetActive(data.currencyNum > 0); if (data.currencyNum > 0) { Util.SetText(price, strPrice); } else { Util.SetText(price, ConfigText.GetDefalutString(TextForMatType.NpcDatingRest, 2)); //免费字样看文本 } bool enoughMoney = CheckMoney(data.currencyType, data.currencyNum); price.color = ColorGroup.GetColor(ColorManagerType.NpcDatingRestOrder, enoughMoney); newMark.SafeSetActive(data.isNew == 0); var btnIndex = btnBuy.transform.parent.GetSiblingIndex(); if (m_itemDataDic.ContainsKey(btnIndex)) { m_itemDataDic.Remove(btnIndex); } m_itemDataDic.Add(btnIndex, data); }
public override bool Initialize(params object[] p) { if (!base.Initialize(p)) { return(false); } confirmButton?.onClick.AddListener(OnConfirm); cancelButton?.onClick.AddListener(() => UnInitialize()); closeButton?.onClick.AddListener(() => UnInitialize()); if (moduleAwakeMatch.CurrentTask != null) { var remainTime = moduleAwakeMatch.maxbuyTimes - moduleAwakeMatch.buyTimes; var time = moduleAwakeMatch.buyTimes; var costNum = 0; ItemPair costItem = null; bool isMyself = moduleAwakeMatch.CurrentTask.taskType == TaskType.Nightmare || (moduleAwakeMatch.CurrentTask.taskType == TaskType.Awake && moduleAwakeMatch.CurrentTaskIsActive); if (isMyself) { remainTime = moduleAwakeMatch.CurrentTask.taskConfigInfo.dayRemainCount - moduleAwakeMatch.CurrentTask.taskData.resetTimes; time = moduleAwakeMatch.CurrentTask.taskData.resetTimes; var arr = moduleAwakeMatch.CurrentTask.taskConfigInfo.costItem; if (arr != null) { var index = Mathd.Clamp(time, 0, arr.Length - 1); costItem = arr[index]; } } else { var arr = moduleAwakeMatch.costItem; if (arr != null) { var index = Mathd.Clamp(time, 0, arr.Length - 1); costItem = arr[index]; } } if (costItem != null) { costNum = costItem.count; var prop = ConfigManager.Get <PropItemInfo>(costItem.itemId); if (prop) { AtlasHelper.SetIcons(costIcon, prop.icon); } } Util.SetText(remainText, Util.Format(ConfigText.GetDefalutString((int)TextForMatType.AwakeStage, 43), remainTime)); Util.SetText(costText, Util.Format(ConfigText.GetDefalutString((int)TextForMatType.AwakeStage, 44), costNum, modulePlayer.gemCount)); if (costText) { costText.color = ColorGroup.GetColor(ColorManagerType.IsMatrialEnough, costNum <= modulePlayer.gemCount); } } return(true); }
private void OnSetMissionFinishedData(Transform node, Task data) { Text t = node.Find("missionName").GetComponent <Text>(); Image icon = node.Find("missionName/missionIcon").GetComponent <Image>(); Util.SetText(t, data.taskNameID); AtlasHelper.SetNpcDateInfo(icon, data.taskIconID); }
private void RefreshInfo() { AssertInit(); Util.SetText(npcName, _source.NpcInfo.name); Util.SetText(endurance, $"{_source.NpcInfo.bodyPower}/{_source.NpcInfo.maxBodyPower}"); Util.SetText(goodFeelingValue, $"+{_source.addPoint}"); AtlasHelper.SetAvatar(icon, _source.NpcInfo.icon); }
public void SetMaxComboKillBg(int rMaxComboKill) { var info = ConfigManager.Get <FactionKillRewardInfo>(rMaxComboKill); if (!string.IsNullOrEmpty(info?.applique)) { AtlasHelper.SetIcons(applique, info.applique); } }
/// <summary> /// 设置玩家自己的橘色头像到目标对象 /// 目标对象应当是一个 UI 元素 /// </summary> /// <param name="o">要显示头像的目标对象</param> /// <param name="useNativeSize">是否使用原始头像大小</param> public static void SetPlayerAvatar(GameObject o, bool useNativeSize = false) { if (!o) { return; } var a = Module_Player.instance.classAvatar ?? string.Empty; AtlasHelper.SetAvatar(o, a, null, useNativeSize); }
private void CloseInfo(PExpendItem[] expend, int throughTimes) { GeneralConfigInfo generalInfo = GeneralConfigInfo.defaultConfig; if (generalInfo == null) { Logger.LogError("pet time is null"); return; } var remainTimes = 0; if (Module_Home.instance.LocalPetInfo != null) { remainTimes = Module_Home.instance.LocalPetInfo.times; } var sysnText = pettask_txt[10] + remainTimes + pettask_txt[9]; Util.SetText(m_restTimes, sysnText); sureopen.onClick.RemoveAllListeners(); sureopen.onClick.AddListener(() => { Module_Home.instance.Opentask(); }); if (expend.Length == 0) { Logger.LogDetail("NO expend"); m_expendTip.gameObject.SetActive(false); return; } m_expendTip.gameObject.SetActive(true); int propid = expend[0].expendid; int propnum = expend[0].expendnum; PropItemInfo item = ConfigManager.Get <PropItemInfo>(propid);//id 是1 或者2 if (item == null) { Logger.LogError("expend prop is null"); m_expendTip.gameObject.SetActive(false); return; } AtlasHelper.SetItemIcon(costimage, item); int num = (int)Module_Player.instance.roleInfo.diamond; if (propid == 1) { num = (int)Module_Player.instance.roleInfo.coin; } var synthetic = "×" + propnum.ToString() + pettask_txt[8] + num + pettask_txt[9]; Util.SetText(havenum, synthetic); }
private void SetRewardInfo(PItem2[] itemlist, List <Transform> tranList, bool first = false) { for (int i = 0; i < tranList.Count; i++) { tranList[i].SafeSetActive(false); } var index = 0; for (int i = 0; i < itemlist.Length; i++) { var info = itemlist[i]; if (info == null || index >= tranList.Count) { continue; } var prop = ConfigManager.Get <PropItemInfo>(info.itemTypeId); if (!prop || !prop.IsValidVocation(modulePlayer.proto)) { continue; } if (first && prop.itemType == PropType.WallPaper && prop.subType == 1) { if (prop == null || prop.mesh == null || prop.mesh.Length < 1) { continue; } m_saveBtn.onClick.RemoveAllListeners(); m_saveBtn.onClick.AddListener(delegate { TakePhoto(prop.mesh[0]); }); UIDynamicImage.LoadImage(m_photo.transform, prop.mesh[0]); for (int j = 0; j < m_lockObj.Count; j++) { if (j + 1 >= prop.mesh.Length) { continue; } AtlasHelper.SetPuzzle(m_lockObj[j].gameObject, prop.mesh[j + 1], null, true); } continue; } tranList[index].SafeSetActive(true); Util.SetItemInfo(tranList[index], prop, info.level, (int)info.num, false, info.star); if (!(prop.itemType == PropType.WallPaper && prop.subType == 1)) { var btn = tranList[index].GetComponentDefault <Button>(); btn.onClick.RemoveAllListeners(); btn.onClick.AddListener(delegate { moduleGlobal.UpdateGlobalTip(info, true, false); }); } index++; } }
private void RefreshExpense() { var info = ConfigManager.Get <PropItemInfo>(moduleShop.curShopMsg.refreshCurrency); if (info != null) { AtlasHelper.SetItemIcon(payTypeImage, info); } Util.SetText(DiamondBySpend_text, "×" + moduleShop.curShopMsg.refreshNum); }
public static void Bind(Transform rRoot, PRoleSummary rRole, UnityAction rOnDeleteClick) { var profession = rRoot.GetComponent <Transform>("profession"); AtlasHelper.SetShared(profession, $"proicon_0{rRole.proto}"); Util.SetText(rRoot.GetComponent <Text>("name"), rRole.name); Util.SetText(rRoot.GetComponent <Text>("level"), $"Lv.{rRole.level}"); Util.SetText(rRoot.GetComponent <Text>("raidValue"), ConfigText.GetDefalutString(204, 36) + rRole.power); rRoot.GetComponent <Button>("delete_btn")?.onClick.AddListener(rOnDeleteClick); }
public void SetNpcInfo(INpcMessage rInfo, Transform targetPos) { if (rInfo == null) { return; } AssertInit(); AtlasHelper.SetShared(_icon, rInfo.icon); SetRelationShip(rInfo.fetterStage); DrawLine(rInfo, targetPos); }
// Update is called once per frame public void SetPlayerInfo(PUnionPlayer playerInfo) { Get(); PPlayerInfo baseInfo = playerInfo.info; if (baseInfo == null) { return; } Module_Avatar.SetClassAvatar(m_headImg, baseInfo.proto, false, baseInfo.gender); headBoxFriend detailBox = m_headBox.GetComponentDefault <headBoxFriend>(); detailBox.HeadBox(baseInfo.headBox); m_name.text = baseInfo.name; m_level.text = "LV." + baseInfo.level; m_contribution.text = ConfigText.GetDefalutString(242, 183) + playerInfo.sentiment.ToString(); if (baseInfo.state == 0) { m_state.text = ConfigText.GetDefalutString(218, 30); m_state.color = Color.gray; } else { m_state.text = ConfigText.GetDefalutString(218, 29); m_state.color = Color.green; } m_rankImg.gameObject.SetActive(false); if (playerInfo.title == 0) { m_rankImg.gameObject.SetActive(true); AtlasHelper.SetShared(m_rankImg.gameObject, "ui_union_level01"); m_rankTxt.text = ConfigText.GetDefalutString(242, 184); } else if (playerInfo.title == 1) { m_rankImg.gameObject.SetActive(true); AtlasHelper.SetShared(m_rankImg.gameObject, "ui_union_level02"); m_rankTxt.text = ConfigText.GetDefalutString(242, 185); } if (baseInfo.roleId == Module_Player.instance.roleInfo.roleId) { detailBox.HeadBox(Module_Player.instance.roleInfo.headBox); m_name.text = Module_Player.instance.name_; m_level.text = "LV." + Module_Player.instance.level; } }
/// <summary> /// 前台Alert /// </summary> /// <param name="part"></param> /// <param name="theMessage"></param> public void ShowAlertMessage(IPart part, string theMessage) { BaseWebForm webPart = part as BaseWebForm; if (webPart == null) { return; } string alertScript = GetAlertScript(theMessage); AtlasHelper.RegisterAtlasStartupScript(webPart.Page, webPart.Page.GetType(), Guid.NewGuid().ToString(), alertScript, false); }
private void UpdateHeadBox() { PropItemInfo info = ConfigManager.Get <PropItemInfo>(Module_Player.instance.roleInfo.headBox == 0 ? 901 : Module_Player.instance.roleInfo.headBox); if (info != null && info.mesh != null && info.mesh.Length > 0) { AtlasHelper.SetShared(headbox_bottom, info.mesh[0]); if (info.mesh.Length > 1) { AtlasHelper.SetShared(headbox_top, info.mesh[1]); } } }
private void SetBaseIndo(PItem info) { PropItemInfo prop = ConfigManager.Get <PropItemInfo>(info.itemTypeId); int index = Module_Forging.instance.GetWeaponIndex(prop); if (index != -1) { AtlasHelper.SetShared(m_weaponIcon.gameObject, m_weaponType[index]); } m_strengLevel.text = "+" + info.growAttr.equipAttr.strength.ToString(); m_weaponName.text = prop.itemName; }
private void SetlableInfo(RectTransform rt, PWeflareInfo info) { if (moduleWelfare.chooseInfo == null || info == null) { return; } var lable = rt.Find("label_Txt").GetComponent <Text>(); var tip = rt.Find("tip"); Util.SetText(lable, info.title); tip.gameObject.SetActive(false); if (info.title.Contains("&")) { var t = info.title.Split('&')[0]; var txt = info.title.Split('&')[1]; tip.gameObject.SetActive(true); Util.SetText(lable, txt); var index = Util.Parse <int>(t); if (index < 0 || index >= recommend.Length) { index = 0; } AtlasHelper.SetShared(tip, recommend[index], null, true); } if (info.type == (int)WelfareType.ActiveNewPuzzle) { Util.SetText(lable, info.introduce); } if (info.id == moduleWelfare.chooseInfo.id || (moduleWelfare.chooseInfo.type == (int)WelfareType.ActiveNewPuzzle && info.type == (int)WelfareType.ActiveNewPuzzle)) { var tog = rt.parent.GetComponentDefault <Toggle>(); tog.isOn = false; m_checkImg.duration = 0.15f; m_checkImg.from = m_checkImg.transform.localPosition; var pos = rt.parent.localPosition; pos.y -= 4; m_checkImg.to = pos; m_checkImg.Play(); tog.isOn = true; } else if (lable.color != Color.white) { var teween = lable.transform.GetComponent <TweenColor>(); teween.PlayReverse(); } var hint = rt.Find("hint"); hint.SafeSetActive(moduleWelfare.GeLableHint(info)); }
private void Name_Spend()//从服务器获取更改名字需要花费的钻石 { if (moduleSet.spend_num == null) { return; } PropItemInfo info = ConfigManager.Get <PropItemInfo>(moduleSet.spend_num.itemTypeId); AtlasHelper.SetItemIcon(spend_name_img1, info); AtlasHelper.SetItemIcon(spend_name_img2, info); two_txt_num.text = moduleSet.spend_num.price.ToString(); sure_change_num.text = moduleSet.spend_num.price.ToString(); }
public void BindData(PMatchInfo rMatchInfo, PBattleInfo rBattleInfo) { Util.SetText(name, rMatchInfo.roleName); Util.SetText(level, $"lv:{rMatchInfo.level}"); Util.SetText(kill, Module_FactionBattle.GetKillString(rBattleInfo.maxCombokill)); Util.SetText(score, rBattleInfo.score.ToString()); killIcon.SafeSetActive(!string.IsNullOrEmpty(kill.text)); var info = ConfigManager.Get <FactionKillRewardInfo>(rBattleInfo.maxCombokill); if (!string.IsNullOrEmpty(info?.applique)) { AtlasHelper.SetIcons(killIcon, info.applique); } }
//Button_Down_Click... private void Button_Down_Click_Extend(object sender, EventArgs e) { //调用模版提供的默认实现.--默认实现可能会调用相应的Action. if (this.Model.ViewLogViewer.FocusedRecord != null) { string fileName = this.Model.ViewLogViewer.FocusedRecord.FileName; string file = LogFiles.CopyFile(fileName); string script = $"window.open('../temp/{file}');"; AtlasHelper.RegisterAtlasStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), script, true); } Button_Down_Click_DefaultImpl(sender, e); }
public void RefreshTip(PetSkill.Skill rSkill, int rLevel, EnumPetMood rMood)//技能 { IniteCompent(); expRemainTime = -1; dropBtn.gameObject.SetActive(false); m_petSkill?.gameObject.SetActive(true); m_rTime.transform.parent.gameObject.SetActive(false); Util.DisableAllChildren(wupin, new[] { "icon", "name" }); AtlasHelper.SetShared(wupin.GetComponent <Image>("icon"), rSkill.skillIcon); Util.SetText(wupin.GetComponent <Text>("name"), Util.Format(ConfigText.GetDefalutString(rSkill.skillName), rLevel)); Util.SetText(tip_text, rSkill.GetDesc(rLevel)); Util.SetText(m_petSkill, Util.Format(ConfigText.GetDefalutString(105000), (int)rMood)); }
public void Init(Buff rBuff, Creature rCreature) { Initelize(); buff = rBuff; buffID = rBuff.ID; OverlapNumber = 1; creature = rCreature; if (!string.IsNullOrEmpty(buff.info.icon)) { AtlasHelper.SetIcons(icon, buff.info.icon); } Util.SetText(desc, buff.info.BuffDesc(buff.BuffLevel)); }
private void SetItemData(Transform node, Module_Npc.NpcMessage data) { if (data == null) { return; } PropItemInfo pinfo = new PropItemInfo(); pinfo.ID = data.npcId; BaseRestrain.SetRestrainData(node.gameObject, pinfo, 0, 0); node.name = data.npcId.ToString(); Text textName = node.Find("Text").GetComponent <Text>(); Image imgRelationShip = node.Find("dateLevelBg/fill").GetComponent <Image>(); Text textTel = node.Find("phoneNumberBg/phoneNumber").GetComponent <Text>(); Text textDesc = node.Find("intro").GetComponent <Text>(); Text textLabel = node.Find("labelBg/label").GetComponent <Text>(); Image icon = node.Find("avatar_back/mask/head_icon").GetComponent <Image>(); Image pledge = node.Find("pledgeState").GetComponent <Image>();//誓约状态 Text textFetterStage = node.Find("goodfeelingLevel").GetComponent <Text>(); Toggle toggle = node.GetComponent <Toggle>(); toggle.group = m_togGroup; //名字 Util.SetText(textName, data.name); //设置关系 SetRelationShip(imgRelationShip, data); //设置Npc标签 Util.SetText(textLabel, data.npcInfo.labelMark); //电话 SetTel(textTel, data); //描述 SetDesc(textDesc, data); //头像 AtlasHelper.SetAvatar(icon, data.icon); //AtlasHelper.SetNpcDateInfo(icon, data.npcInfo.datingAvatar); //誓约状态 pledge.SafeSetActive(data.fetterStage == data.maxFetterStage); //羁绊等级名称 Util.SetText(textFetterStage, data.curStageName); int togIndex = toggle.transform.GetSiblingIndex(); if (m_itemDataDic.ContainsKey(togIndex)) { m_itemDataDic.Remove(togIndex); } m_itemDataDic.Add(togIndex, data); }
private void CreateNpc() { _npcDict.Clear(); for (var i = NpcTypeID.None + 1; i < NpcTypeID.StoryNpc; i++) { var t = _root.AddNewChild(_templete); t.SafeSetActive(true); t.name = i.ToString(); var npcInfo = ConfigManager.Get <NpcInfo>((int)i); AtlasHelper.SetAvatar(t.GetComponent <Transform>("head_icon"), npcInfo?.icon); var npc = moduleNpc.GetTargetNpc(i); t.GetComponent <Transform>("avatar_topbg_img").SafeSetActive(npc.maxFetterLv == npc.fetterLv); _npcDict.Add(i, t.GetComponent <Toggle>()); } }
private void RefreshSelfInfo() { Util.SetText(m_selfFaction, moduleFactionBattle.SelfFactionName); Util.SetText(m_selfRank, Module_FactionBattle.GetRankLabel(moduleFactionBattle.SelfRank)); Util.SetText(m_selfScore, moduleFactionBattle.SelfScore.ToString()); Util.SetText(m_selfComboKill, Module_FactionBattle.GetKillString(moduleFactionBattle.ComboKill)); Util.SetText(m_selfMaxComboKill, Module_FactionBattle.GetKillString(moduleFactionBattle.MaxComboKill)); m_selfMaxComboKill?.transform.parent.SafeSetActive(!string.IsNullOrEmpty(m_selfMaxComboKill?.text)); var info = ConfigManager.Get <FactionKillRewardInfo>(moduleFactionBattle.MaxComboKill); if (!string.IsNullOrEmpty(info?.applique)) { AtlasHelper.SetIcons(m_selfApplique, info.applique); } }
/// <summary> /// 设置指定角色职业头像到目标对象 /// 目标对象应当是一个 UI 元素 /// </summary> /// <param name="o">要显示头像的目标对象</param> /// <param name="c">要显示头像的角色</param> /// <param name="useNativeSize">是否使用原始头像大小</param> public static void SetClassAvatar(GameObject o, Creature c, bool useNativeSize = false) { if (!o) { return; } if (c && (c.isMonster || c.avatar.StartsWith(npcAvatarPrefix))) { AtlasHelper.SetAvatar(o, c.avatar); return; } SetClassAvatar(o, c ? c.roleProto : 0, useNativeSize, c ? c.gender : -1); }
private void RefreshSkill() { if (SelectPet == null) { return; } var skill = SelectPet.GetSkill(); if (skill == null) { return; } AtlasHelper.SetShared(skillIcon, skill.skillIcon); Util.SetText(skillDescText, SelectPet.SkillName); }