public void SetEquipItem(int idx, Item item, UICharEquip owner, bool equiped) { this.owner = owner; this.index = idx; this.item = item; this.isEquiped = equiped; if (this.title != null) { this.title.text = this.item.Define.Name; } if (this.level != null) { this.level.text = item.Define.Level.ToString(); } if (this.limitClass != null) { this.limitClass.text = item.Define.LimitClass.ToString(); } if (this.LimitCategory != null) { this.LimitCategory.text = item.Define.Category; } if (this.icon != null) { this.icon.overrideSprite = Resloader.Load <Sprite>(this.item.Define.Icon); } }
public void SetMainIcon(string iconName, string text = null) { if (mainText != null) { this.mainText.text = text; } this.mainImage.overrideSprite = Resloader.Load <Sprite>(iconName); }
internal void SetItem(Buff buff) { this.buff = buff; if (this.icon != null) { this.icon.overrideSprite = Resloader.Load <Sprite>(this.buff.Define.Icon); this.icon.SetAllDirty(); } }
internal void SetSkill(Skill value) { this.skill = value; if (this.icon != null) { this.icon.overrideSprite = Resloader.Load <Sprite>(this.skill.Define.Icon); this.icon.SetAllDirty(); } }
public void SetSkill(Skill item) { this.skill = item; if (this.icon != null) { this.icon.overrideSprite = Resloader.Load <Sprite>(this.skill.Define.Icon); } this.SetCD(this.skill.Define.Cd); }
public void PlaySound(string name) { AudioClip clip = Resloader.Load <AudioClip>(SoundPath + name); if (clip == null) { Debug.LogWarningFormat("PlaySound:{0} not existed", name); return; } soundAudioSource.PlayOneShot(clip); }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="title"></param> /// <param name="btnOk"></param> /// <param name="btnCancle"></param> /// <param name="emptyTips"></param> /// <returns></returns> public static UIInputBox Show(string message, string title = "", string btnOk = "", string btnCancle = "", string emptyTips = "") { if (cacheObject == null) { cacheObject = Resloader.Load <Object>("UI/UIInputBox"); } GameObject go = (GameObject)GameObject.Instantiate(cacheObject); UIInputBox inputBox = go.GetComponent <UIInputBox>(); inputBox.Init(title, message, btnOk, btnCancle, emptyTips); return(inputBox); }
public void SetShopItem(int id, ShopItemDefine shopItem, UIShop owner) { this.shop = owner; this.ShopItemID = id; this.ShopItem = shopItem; this.item = DataManager.Instance.Items[this.ShopItem.ItemID]; this.title.text = this.item.Name; this.count.text = ShopItem.Count.ToString(); this.price.text = ShopItem.Price.ToString(); this.icon.overrideSprite = Resloader.Load <Sprite>(item.Icon); }
public static UIMessageBox Show(string message, string title = "", MessageBoxType type = MessageBoxType.Information, string btnOk = "", string btnCancel = "") { if (Cacheobject == null) { Cacheobject = Resloader.Load <Object>("UI/UIMessageBox"); } GameObject go = (GameObject)GameObject.Instantiate(Cacheobject); UIMessageBox msgbox = go.GetComponent <UIMessageBox>(); msgbox.Init(title, message, type, btnOk, btnCancel); return(msgbox); }
// Update is called once per frame void Update() { if (User.Instance.CurrentCharacter == null) { return; } if (User.Instance.CurrentCharacter.Level != playerLv) { playerLv = User.Instance.CurrentCharacter.Level; textLevel.text = playerLv.ToString(); textName.text = User.Instance.CurrentCharacter.Name; imgHead.sprite = Resloader.Load <Sprite>(User.Instance.curCharacter.Define.HeadIcon); } }
public RideController LoadRide(int rideId, Transform parent) { var rideDefine = DataManager.Instance.Rides[rideId]; Object obj = Resloader.Load <Object>(rideDefine.Resource); if (obj == null) { Debug.LogErrorFormat("Ride[{0}] Resource[{1}] not existed.", rideDefine.ID, rideDefine.Resource); return(null); } GameObject go = (GameObject)Instantiate(obj, parent); go.name = "Ride_" + rideDefine.ID + "_" + rideDefine.Name; return(go.GetComponent <RideController>()); }
public void SetItem(Skill item, UISkill owner, bool equiped) { this.item = item; if (this.title != null) { this.title.text = this.item.Define.Name; } if (this.level != null) { this.level.text = this.item.Info.Level.ToString(); } if (this.icon != null) { this.icon.overrideSprite = Resloader.Load <Sprite>(this.item.Define.Icon); } }
public void PlayMusic(string name) { AudioClip clip = Resloader.Load <AudioClip>(MusicPath + name); if (clip == null) { Debug.LogWarningFormat("PlayMusic:{0} not existed", name); return; } if (musicAudioSource.isPlaying) { musicAudioSource.Stop(); } musicAudioSource.clip = clip; musicAudioSource.Play(); }
private void CreateCharacterObject(Character character) { if (!Characters.ContainsKey(character.entityId) || Characters[character.entityId] == null) { Object obj = Resloader.Load <Object>(character.Define.Resource); if (obj == null) { Debug.LogErrorFormat("Character[{0}] Resource[{1}] not existed.", character.Define.TID, character.Define.Resource); return; } GameObject go = (GameObject)Instantiate(obj, this.transform); go.name = "Character_" + character.Info.Id + "_" + character.Info.Name; Characters[character.entityId] = go; UIWorldElementManager.Instance.AddCharacterNameBar(go.transform, character); } this.InitGameObject(Characters[character.entityId], character); }
public void UpdateMiniMap() { Common.Data.MapDefine mapCfg = DataManager.Instance.Maps[MapService.Instance.CurMapID]; //根据配置决定小地图是否显示 if (string.IsNullOrEmpty(mapCfg.MiniMap)) { this.gameObject.SetActive(false); return; } else if (!this.gameObject.activeSelf) { this.gameObject.SetActive(true); } txtMapName.text = mapCfg.Name; imgMap.sprite = Resloader.Load <Sprite>("MiniMap/" + mapCfg.MiniMap); }
public void SetRideItem(Item item, UIRide owner, bool equiped) { this.item = item; if (this.title != null) { this.title.text = this.item.itemDefine.Name; } if (this.level != null) { this.level.text = item.itemDefine.Level.ToString(); } if (this.icon != null) { this.icon.overrideSprite = Resloader.Load <Sprite>(this.item.itemDefine.Icon); } }
private void CreateCharacterObject(Character character) { if (!Characters.ContainsKey(character.entityId) || Characters[character.entityId] == null) { Object obj = Resloader.Load <Object>(character.Define.Resource); if (obj == null) { Debug.LogErrorFormat("Character[{0}] Resource[{1}] not existed.", character.Define.TID, character.Define.Resource); return; } GameObject go = (GameObject)Instantiate(obj); go.name = "Character_" + character.entityId + "_" + character.Info.Name; go.transform.position = GameObjectTool.LogicToWorld(character.position); go.transform.forward = GameObjectTool.LogicToWorld(character.direction); go.transform.SetParent(_parent); Characters[character.entityId] = go; EntityController ec = go.GetComponent <EntityController>(); if (ec != null) { ec.entity = character; ec.isPlayer = character.IsPlayer; EntityManager.Instance.RegisterEntityChangeNotify(character.entityId, ec); } PlayerInputController pc = go.GetComponent <PlayerInputController>(); if (pc != null) { if (character.Info.Id == Models.User.Instance.CurrentCharacter.Id) { User.Instance.CurrentCharacterObject = go; GameManager.CameraMgr.player = go; pc.enabled = true; pc.character = character; pc.entityController = ec; } else { pc.enabled = false; } } GameManager.NameMgr.AddHeadBar(go.transform, character); } }
private void CreateCharacter(Entities.Character character) { if (!Characters.ContainsKey(character.entityId) || Characters[character.entityId] == null) { UnityEngine.Object obj = Resloader.Load <UnityEngine.Object>(character.Define.Resource); if (obj == null) { Debug.LogErrorFormat("Character[{0}] Resource[{1}] not existed.", character.Define.TID, character.Define.Resource); return; } GameObject go = (GameObject)Instantiate(obj, this.transform); go.name = "Character_" + character.Info.Id + "_" + character.Info.Name; go.transform.position = GameObjectTool.LogicToWorld(character.position); go.transform.forward = GameObjectTool.LogicToWorld(character.direction); Characters[character.entityId] = go; UIWorldElementManager.Instance.AddCharacterNameBar(go.transform, character); } InitGameObj(character, Characters[character.entityId]); }
public Sprite LoadCurrentMinimap() { return(Resloader.Load <Sprite>("UI/Minimap/" + User.Instance.CurrentMapData.MiniMap)); }
// Use this for initialization private void Start() { hpBar = Resloader.Load <GameObject>("UI/UIHeadBar"); GameManager.NameMgr = this; }