コード例 #1
0
    public void Load()
    {
        List <SkillWrapper> sortedSkills = new List <SkillWrapper>(m_entity.m_skills);

        sortedSkills.Sort(new SkillComparer());
        sortedSkills.Reverse();

        foreach (SkillWrapper wrapper in sortedSkills)
        {
            GameObject      skillObject   = Instantiate(m_skillPrefab, m_contentParent);
            Image           skillIcon     = skillObject.GetComponent <Image>();
            TextMeshProUGUI trainingLevel = skillObject.GetComponentInChildren <TextMeshProUGUI>();

            skillIcon.sprite   = wrapper.GetSkill().m_icon;
            trainingLevel.text = wrapper.TrainingLevel.ToString();

            if (!wrapper.Learned)
            {
                trainingLevel.text = "";
                skillIcon.color    = new Color(1, 1, 1, m_nonLearnedAlpha / 255f);
            }

            UISkill uiSkill = skillObject.GetComponent <UISkill>();

            uiSkill.m_skill  = wrapper;
            uiSkill.m_loader = this;
        }
    }
コード例 #2
0
 public void entering()
 {
     if (movedSkills != null)
     {
         auxSkill = movedSkills.GetComponentInChildren <UISkill>();
     }
 }
コード例 #3
0
    /// <summary>
    /// 初始化视图显示
    /// </summary>
    public void InitView(HeroModel hero)
    {
        //头像
        ResourceManager.Instance.Load(Paths.RES_HEAD + hero.Name, typeof(Image), this);
        //血条
        barHp.value = (float)hero.CurrHp / hero.MaxHp;
        txtHp.text  = string.Format("{0}/{1}", hero.CurrHp, hero.MaxHp);
        //蓝条
        barMp.value = (float)hero.CurMp / hero.MaxMp;
        txtMp.text  = string.Format("{0}/{1}", hero.CurMp, hero.MaxMp);
        //经验
        barExp.value = (float)hero.Exp / (hero.Level * 100);
        txtLv.text   = string.Format("Lv.{0}", hero.Level);
        //统计
        txtKDA.text   = string.Format("Kill:{0}     Dead:{1}", hero.Kill, hero.Dead);
        txtMoney.text = hero.Money.ToString();
        //属性
        txtAttack.text  = hero.Attack.ToString();
        txtDefense.text = hero.Defense.ToString();

        //更新技能列表
        for (int i = 0; i < skills.Length; i++)
        {
            UISkill skill = skills[i];
            skill.Init(hero.Skills[i]);
        }
    }
コード例 #4
0
    /// <summary>
    /// 更新显示
    /// </summary>
    /// <param name="hero"></param>
    public void UpdateView(HeroModel hero)
    {
        //血条
        barHp.value = (float)hero.CurrHp / hero.MaxHp;
        txtHp.text  = string.Format("{0}/{1}", hero.CurrHp, hero.MaxHp);
        //死亡检查
        if (hero.CurrHp == 0)
        {
            //显示灰白屏幕
            //TODO
        }

        //蓝条
        barMp.value = (float)hero.CurMp / hero.MaxMp;
        txtMp.text  = string.Format("{0}/{1}", hero.CurMp, hero.MaxMp);
        //经验
        barExp.value = (float)hero.Exp / (hero.Level * 100);
        txtLv.text   = string.Format("Lv.{0}", hero.Level);
        //统计
        txtKDA.text   = string.Format("Kill:{0}     Dead:{1}", hero.Kill, hero.Dead);
        txtMoney.text = hero.Money.ToString();
        //属性
        txtAttack.text  = hero.Attack.ToString();
        txtDefense.text = hero.Defense.ToString();

        //更新技能列表
        for (int i = 0; i < skills.Length; i++)
        {
            UISkill skill = skills[i];
            skill.Init(hero.Skills[i]);
        }
    }
コード例 #5
0
 public void ConfigureSkill(UISkill button)
 {
     button.SetCurrentSkill(this);
     button.ChangeIcon(imageIcon);
     button.ChangeCoolDown(cooldownTime);
     button.SetTimer(timeActivated);
     button.ConfigureButton();
 }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        UICanvas UIcanvas = GameObject.FindGameObjectWithTag("UICanvas").GetComponent <UICanvas>();

        Tooltip = UIcanvas.Tooltip;
        stat    = UIcanvas.Stat.GetComponent <UIStat>();
        skill   = UIcanvas.Skill.GetComponent <UISkill>();
    }
コード例 #7
0
 private void eliminateOtherSkills()
 {
     SkillbarPanel[] panels = GameObject.FindObjectsOfType <SkillbarPanel>();
     foreach (SkillbarPanel panel in panels)
     {
         UISkill skill = panel.GetComponentInChildren <UISkill>();
         if (skill != null && skill.gameObject != this.gameObject && skill.skillNumber == mySkill.skillNumber)
         {
             Destroy(skill.gameObject);
         }
     }
 }
コード例 #8
0
 //初始化
 public void Init()
 {
     //1.拿到技能数据,初始化技能按钮
     for (int i = 0; i < GameController.Instance.playerData.SkillList.Count; i++)
     {
         UISkill uiskill = transform.Find("Skill/ButtonSkill" + (i + 1)).GetComponent <UISkill>();
         Skill   skill   = GameController.Instance.playerData.SkillList[i];
         uiskill.Init(skill);
         //将uiskill,引用存入字典结构
         uiSkillDic.Add(skill.Id, uiskill);
     }
 }
コード例 #9
0
 private void OnEnable()
 {
     for (int i = 0; i < NumberOfSlots; i++)
     {
         GameObject instance = Instantiate(slotPrefab);
         instance.transform.SetParent(slopPanel);
         instance.transform.localScale = new Vector3(1, 1, 1);
         UISkill tempUIItem = instance.GetComponentInChildren <UISkill>();
         //  tempUIItem.Initialization(singletonInventory);
         uISkills.Add(tempUIItem);
     }
     Cursor.visible = true;
     Enabling?.Invoke();
 }
コード例 #10
0
 void Start()
 {
     //Initializing stuff
     if (myImage == null)
     {
         myImage = this.GetComponent <Image>();
     }
     myImage.color = defaultColor;
     movedSkills   = GameObject.Find("Moved Skills");
     mySkill       = GetComponent <UISkill>();
     player        = GameObject.FindObjectOfType <Player>();
     isMouseOverMe = false;
     wasBeingUsed  = false;
 }
コード例 #11
0
    public void FindUICanvas()
    {
        UICanvas UIcanvas = GameObject.FindGameObjectWithTag("UICanvas").GetComponent <UICanvas>();

        UIStat         = UIcanvas.stat.GetComponent <UIStat>();
        UIIcon         = UIcanvas.icon.GetComponent <UIIcon>();
        UISkill        = UIcanvas.skill.GetComponent <UISkill>();
        UIRecall       = UIcanvas.recall;
        UIRightTop     = UIcanvas.rightTopUI.GetComponent <UIRightTop>();
        isUICanvasFind = true;

        chatFunction = GameObject.FindGameObjectWithTag("ChatManager").GetComponentInChildren <ChatFunction>();
        csTextPool   = GameObject.FindGameObjectWithTag("CSText").GetComponent <CsTextPool>();
    }
コード例 #12
0
    // Update is called once per frame
    void Update()
    {
        string s = Input.inputString;

        foreach (char c in s)
        {
            foreach (SkillbarPanel panel in panels)
            {
                if (panel.c == c)
                {
                    UISkill skill = panel.GetComponentInChildren <UISkill>();
                    if (skill != null)
                    {
                        int          a          = skill.skillNumber;
                        Ray          ray        = Camera.main.ScreenPointToRay(Input.mousePosition);
                        RaycastHit[] rcArray    = Physics.RaycastAll(ray);
                        Character    character  = null;
                        Vector3      floorPoint = Vector3.zero;
                        foreach (RaycastHit rc in rcArray)
                        {
                            if (isFloor(rc))
                            {
                                //player.castSkill(a, rc.point);
                                floorPoint = rc.point;
                            }
                            if (getCharacter(rc) != null)
                            {
                                character = getCharacter(rc);
                            }
                        }
                        player.castSkill(a, floorPoint, character);
                    }
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Menu[] menus   = GameObject.FindObjectsOfType <Menu>();
            bool   noMenus = true;
            foreach (Menu menu in menus)
            {
                noMenus = false;
                menu.close();
            }
            if (noMenus)
            {
                openMainMenu();
            }
        }
    }
コード例 #13
0
 public UISkillPanel(RectTransform parent)
 {
     transform = CanvasTool.InstantiateEmptyUI("UISkillPanel", parent, Vector3.zero).GetComponent <RectTransform>();
     ISkillModle[] modleArr = SceneManager.mainCharacter.skill.GetSkillModleArray();
     if (null == modleArr || modleArr.Length == 0 || modleArr.Length > localPosArr.Length)
     {
         DebugTool.LogError("UISkillPanel UISkillPanel modleArr is error!!!");
         return;
     } // end if
     skillUIArr = new UISkill[modleArr.Length];
     for (int i = 0; i < modleArr.Length; i++)
     {
         skillUIArr[i] = new UISkill(modleArr[i], transform, localPosArr[i], new Vector2(100, 100));
     } // end for
 }     // end UISkillPanel
コード例 #14
0
 void detectNewSkill()
 {
     if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
     {
         if (auxSkill != null)
         {
             //auxSkill.setMovable(false);
             eliminateSkillsInParent();
             auxSkill.gameObject.GetComponent <RectTransform>().SetParent(this.transform.parent);
             auxSkill.transform.position = this.transform.position;
             mySkill     = auxSkill;
             skillNumber = auxSkill.skillNumber;
             //keyboard.setSkill(c, this.mySkill);
         }
     }
 }
コード例 #15
0
ファイル: UISkillItem.cs プロジェクト: Lenzan/newmmo
 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);
     }
 }
コード例 #16
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            UISkill m_Button = target as UISkill;

            if (EditorTools.DrawHeader("技能相关"))
            {
                EditorTools.BeginContents();
                GUILayout.BeginVertical();
                GUILayout.Space(4f);
                m_Button.Mask = (EditorGUILayout.ObjectField("冷却遮罩", m_Button.ClickClip, typeof(UIImage), true)) as UIImage;

                GUILayout.Space(4f);
                GUILayout.EndVertical();
                EditorTools.EndContents();
            }
        }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        player       = GameObject.FindObjectOfType <Player>();
        image        = this.GetComponent <Image>();
        initialColor = image.color;
        inviColor    = image.color;
        inviColor.a  = invisibleAlpha;
        mySkill      = this.transform.parent.GetComponentInChildren <UISkill>();
        if (mySkill != null)
        {
            skillNumber = mySkill.skillNumber;
        }

        movedSkills = GameObject.Find("Moved Skills");
        if (movedSkills != null)
        {
            auxSkill = movedSkills.GetComponentInChildren <UISkill>();
        }
    }
コード例 #18
0
    void OnDestroy()
    {
        instance = null;

        rootArray           = null;
        cameraArray         = null;
        lobbyPanelPathArray = null;

        uiLobby       = null;
        uiLobbyButton = null;
        uiMessageBox  = null;
        uiHero        = null;
        uiSkill       = null;
        uiBullet      = null;
        uiGoldShop    = null;
        uiCashShop    = null;

        uiLobbyButton = null;
        lobbyTabGroup = null;
    }
コード例 #19
0
    public void setModeCancel()
    {
        if (!isLocalPlayer)
        {
            print("Not local player!");
            return;
        }
        print("Local player! Cancel");
        if (selectedShip != null)
        {
            selectedShip.GetComponent <JPShip>().SetSelected(false);
        }
        selectedShip = null;
        targetShip   = null;
        print("Mode Cancel " + targetMode);
        targetMode = 0;
        marker.SetActive(false);

        currentSkill       = null;
        currentButton      = null;
        skillActive        = false;
        skillTimingSpacing = false;
    }
コード例 #20
0
    public void SkillPressed(int skillNum, UISkill sendingSkill)
    {
        currentSkill = null;
        skillIndex   = skillNum;
        //tapCount = 0;
        BaseSkill tempSkill = selectedShip.GetComponent <JPShip>().skills[skillNum];

        if ((!tempSkill.gameObjectRequired) && (!tempSkill.locationRequired))
        {
            currentButton = sendingSkill;
            SetSkill();
            skillActive        = true;
            skillTimingSpacing = false;
        }
        else
        {
            currentSkill       = tempSkill;
            currentButton      = sendingSkill;
            skillActive        = true;
            skillTimingSpacing = true;
        }
        selectedShip.GetComponent <JPShip>().skills[skillNum].TriggerSkillPreview(false);
    }
コード例 #21
0
 public void exiting()
 {
     auxSkill = null;
 }
コード例 #22
0
 public void SkillPreview(int skillNum, UISkill sendingSkill)
 {
     print("Input preview " + skillNum);
     selectedShip.GetComponent <JPShip>().skills[skillNum].TriggerSkillPreview(true);
 }
コード例 #23
0
    private void LoadUICompleteCB(GameObject gameObj, System.Guid uid, params object[] param)
    {
        if (gameObj != null)
        {
            GameObject createObj = Instantiate(gameObj) as GameObject;

            createObj.transform.parent        = rootArray[(int)eRootType.Type_Back].transform;
            createObj.transform.localPosition = Vector3.zero;
            createObj.transform.localScale    = gameObj.transform.localScale;

            switch ((eUIType)param[0])
            {
            case eUIType.Type_Lobby:
                uiLobby = createObj.GetComponent <UILobby>();
                break;

            case eUIType.Type_Lobby_Button:
                uiLobbyButton = createObj.GetComponent <UILobbyButton>();
                break;

            case eUIType.Type_MessageBox:
                uiMessageBox = createObj.GetComponent <UIMessageBox>();
                break;

            case eUIType.Type_Waiting:
                uiWaiting = createObj.GetComponent <UIWaiting>();
                break;

            case eUIType.Type_Hero:
                uiHero = createObj.GetComponent <UIHero>();
                if (lobbyTabGroup != null)
                {
                    lobbyTabGroup[(int)eUILobbyTab.Type_Hero] = uiHero;
                }
                break;

            case eUIType.Type_Skill:
                uiSkill = createObj.GetComponent <UISkill>();
                if (lobbyTabGroup != null)
                {
                    lobbyTabGroup[(int)eUILobbyTab.Type_Skill] = uiSkill;
                }
                break;

            case eUIType.Type_Weapon:
                uiBullet = createObj.GetComponent <UIBullet>();
                if (lobbyTabGroup != null)
                {
                    lobbyTabGroup[(int)eUILobbyTab.Type_Weapon] = uiBullet;
                }
                break;

            case eUIType.Type_Gold:
                uiGoldShop = createObj.GetComponent <UIGoldShop>();
                if (lobbyTabGroup != null)
                {
                    lobbyTabGroup[(int)eUILobbyTab.Type_Gold] = uiGoldShop;
                }
                break;

            case eUIType.Type_Gem:
                uiCashShop = createObj.GetComponent <UICashShop>();
                if (lobbyTabGroup != null)
                {
                    lobbyTabGroup[(int)eUILobbyTab.Type_Gem] = uiCashShop;
                }
                break;
            }
        }
    }