public VirtualButtonView(GameMoudle moudle, GameView view, UIPrefab prefab) : base(moudle, view, prefab)
 {
     GetNode <Button>("btnNormalAttack").onClick.AddListener(() => OnClick(ModelAttackLevel.Normal));
     GetNode <Button>("btnSkiilOne").onClick.AddListener(() => OnClick(ModelAttackLevel.SkillOne));
     GetNode <Button>("btnSkiilTwo").onClick.AddListener(() => OnClick(ModelAttackLevel.SkillTwo));
     GetNode <Button>("btnSkiilThree").onClick.AddListener(() => OnClick(ModelAttackLevel.SkillThree));
 }
Exemplo n.º 2
0
 public PlayerView(GameMoudle moudle, GameView view, UIPrefab prefab) : base(moudle, view, prefab)
 {
     if (!GameConfig.isDamageUseTextImage)
     {
         m_stackDamageText = new Stack <Transform>();
     }
     m_dicHPProcess = new Dictionary <string, UIPrefab>();
     GetNode <UIImage>("hpProcess").FillAmountX = 1;
 }
Exemplo n.º 3
0
 private int AddItem(string itemName, UIPrefab item)
 {
     if (!m_dicItem.ContainsKey(itemName))
     {
         m_dicItem.Add(itemName, new List <UIPrefab>());
     }
     m_dicItem[itemName].Add(item);
     return(m_dicItem[itemName].Count - 1);
 }
    public ModelPlayer(GameObject node, ModelAttackRoleData attackData) : base(node, attackData)
    {
        m_curFoward = m_transform.rotation.eulerAngles.y;
        SetHands("Glove", "Glove");
        UIPrefab  prefab     = gameObject.GetComponent <UIPrefab>();
        Transform weaponNode = prefab.GetNode <Transform>("headusOBJexport009");

        m_weapon = weaponNode.GetComponent <ModelWeapon>();
        SetWeapon(m_weapon);
        m_bulletObj = Resources.Load <GameObject>("ModelBullet");
        m_weapon.SetBullet(m_bulletObj, OnTriggerEnter);
    }
Exemplo n.º 5
0
    public void UpdateHPProcess(string nodeName, float hpPercent)
    {
        if (!m_dicHPProcess.ContainsKey(nodeName))
        {
            DebugTool.LogError("PlayerView UpdateHPProcess node is not exit\t" + nodeName);
            return;
        }
        UIPrefab prefab    = m_dicHPProcess[nodeName];
        UIImage  hpProcess = prefab.GetNode <UIImage>("hpProcess");

        hpProcess.FillAmountX = hpPercent;
        if (hpPercent == 0)
        {
            m_dicHPProcess.Remove(nodeName);
            GameObject.Destroy(prefab.gameObject);
        }
    }
Exemplo n.º 6
0
    static private void MakeAtlas()
    {
        string spriteDir = Application.dataPath + "/Resources/Prefabs/Sprite";

        if (!Directory.Exists(spriteDir))
        {
            Directory.CreateDirectory(spriteDir);
        }

        string uiDir = Application.dataPath + "/Art/UI/RawUI";

        if (!Directory.Exists(uiDir))
        {
            Directory.CreateDirectory(uiDir);;
        }
        DirectoryInfo rootDirInfo = new DirectoryInfo(uiDir);

        foreach (DirectoryInfo dirInfo in rootDirInfo.GetDirectories())
        {
            GameObject      go       = new GameObject(dirInfo.Name);
            PrefabComponent pc       = go.AddComponent <PrefabComponent>();
            FileInfo[]      files    = dirInfo.GetFiles("*png", SearchOption.AllDirectories);
            UIPrefab[]      uiPrefab = new UIPrefab[files.Length];
            string          allPath  = "";
            int             count    = 0;
            foreach (FileInfo pngFile in dirInfo.GetFiles("*.png", SearchOption.AllDirectories))
            {
                UIPrefab uiP = new UIPrefab();
                allPath = pngFile.FullName;
                string assetPath = allPath.Substring(allPath.IndexOf("Assets"));
                Sprite sprite    = AssetDatabase.LoadAssetAtPath <Sprite>(assetPath);
                uiP.name          = sprite.name;
                uiP.sprite        = sprite;
                uiPrefab[count++] = uiP;
            }
            pc.uiPrefab = uiPrefab;
            allPath     = spriteDir + "/" + go.name + ".prefab";
            string prefabPath = allPath.Substring(allPath.IndexOf("Assets"));
            PrefabUtility.CreatePrefab(prefabPath, go);
            GameObject.DestroyImmediate(go);
        }
        AssetDatabase.Refresh();
    }
Exemplo n.º 7
0
 public void close()
 {
     onClose();
     UIPrefab.SetActive(false);
 }
 public LoadingView(GameMoudle moudle, GameView view, UIPrefab prefab) : base(moudle, view, prefab)
 {
     GetNode <UIImage>("loadingProcess").FillAmountX = 0;
 }
Exemplo n.º 9
0
 public Prefab(UIPrefab prefab)
 {
     m_rootNode   = prefab;
     m_gameobject = prefab.gameObject;
     m_transform  = prefab.transform;
 }
Exemplo n.º 10
0
 public void AddUI(UIPrefab uiPrefab)
 {
     m_ui.Add(Instantiate(Resources.Load(m_uiPrefabPath[(int)uiPrefab])) as GameObject);
     m_ui[m_ui.Count - 1].GetComponent <Canvas>().sortingOrder = m_ui.Count;
     m_ui[m_ui.Count - 1].transform.SetParent(this.gameObject.transform);
 }
Exemplo n.º 11
0
 public SelectView(GameMoudle moudle, GameView view, UIPrefab prefab) : base(moudle, view, prefab)
 {
 }
Exemplo n.º 12
0
 public View(GameMoudle moudle, GameView view, UIPrefab prefab) : base(prefab)
 {
     m_moudle = moudle;
     m_view   = view;
 }