示例#1
0
    // Use this for initialization
    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 = this.item.Define.Level.ToString();
        }
        if (limitClass != null)
        {
            this.limitClass.text = item.Define.LimitClass.ToString();
        }
        if (this.limitCategory != null)
        {
            this.limitCategory.text = item.Define.Category;
        }
        if (icon != null)
        {
            this.icon.overrideSprite = Resloader.Load <Sprite>(this.item.Define.Icon);
        }
    }
示例#2
0
 public void SetMainIcon(string iconName, string text = null)
 {
     if (mainText != null)
     {
         this.mainText.text = text;
     }
     this.mainImage.overrideSprite = Resloader.Load <Sprite>(iconName);
 }
示例#3
0
 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();
     }
 }
示例#4
0
 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);
 }
示例#5
0
 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();
     }
 }
示例#6
0
    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);
    }
示例#7
0
/// <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);
    }
示例#8
0
    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);
    }
示例#10
0
 // 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);
     }
 }
示例#11
0
    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>());
    }
示例#12
0
 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);
     }
 }
示例#13
0
    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();
    }
示例#14
0
 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);
 }
示例#15
0
    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);
    }
示例#16
0
    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);
        }
    }
示例#17
0
    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);
        }
    }
示例#18
0
    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]);
    }
示例#19
0
 public Sprite LoadCurrentMinimap()
 {
     return(Resloader.Load <Sprite>("UI/Minimap/" + User.Instance.CurrentMapData.MiniMap));
 }
示例#20
0
 // Use this for initialization
 private void Start()
 {
     hpBar = Resloader.Load <GameObject>("UI/UIHeadBar");
     GameManager.NameMgr = this;
 }