コード例 #1
0
    public static MeshGroup GetMeshGroup(string filename, string aniname)
    {
        if (mapGroupGroup.ContainsKey(filename))
        {
            return(mapGroupGroup[filename].GetMeshGroup(aniname));
        }
        else
        {
            //判断是HA角色 还是K角色
            var data = MeshGroupGroupDataHA.Create(filename);
            if (data == null)
            {
                data = MeshGroupGroupDataK.Create(filename);
            }
            if (data != null)
            {
                mapGroupGroup[filename] = new MeshGroupGroup(data);
                return(mapGroupGroup[filename].GetMeshGroup(aniname));
            }
            else
            {
                Debug.Log("error:" + filename);
            }
        }

        return(null);
    }
コード例 #2
0
    void InitKAni()
    {
        MeshGroupGroupDataK kdata = group.data as MeshGroupGroupDataK;

        if (kdata != null && anicontroller == null)
        {
            string _name = this.defaultanim;
            if (System.IO.Path.DirectorySeparatorChar == '/')
            {
                _name = _name.Replace('\\', '/');
            }
            _name         = System.IO.Path.GetFileNameWithoutExtension(_name);
            _name         = System.IO.Path.GetFileNameWithoutExtension(_name).ToLower();
            anicontroller = new KAnim.SpriteAniController(GetKAnim(_name).GetElement(null));
            //Debug.Log("new kanicontroller");
        }
    }
コード例 #3
0
    static void Save()
    {
        #if UNITY_EDITOR
        var _files = System.IO.Directory.GetFiles(System.IO.Path.GetFullPath("."), "*.Puppet.xml", System.IO.SearchOption.AllDirectories);
        foreach (var f in _files)
        {
            string file = f;
            var    i    = file.ToLower().LastIndexOf("resources");
            file = file.Substring(i + "resources".Length + 1);
            var i2 = file.LastIndexOf('.');
            file = file.Substring(0, i2);   //must be。 remove ext name
            file = file.Replace('\\', '/'); //must be。 use / symble
            var data = MeshGroupGroupDataHA.Create(file);
            if (data != null)
            {
                mapGroupGroup[file] = new MeshGroupGroup(data);
            }
        }

        var _files2 = System.IO.Directory.GetFiles(System.IO.Path.GetFullPath("."), "seeds.bin.bytes", System.IO.SearchOption.AllDirectories);
        Debug.Log("MeshGroupMgr:Save" + _files2.Length);
        foreach (var f in _files2)
        {
            string file = f;

            var i = file.ToLower().LastIndexOf("resources");
            file = file.Substring(i + "resources".Length + 1);
            var i2 = file.LastIndexOf('.');
            file = file.Substring(0, i2);   //must be。 remove ext name
            file = System.IO.Path.GetDirectoryName(file);

            file = file.Replace('\\', '/'); //must be。 use / symble

            var data = MeshGroupGroupDataK.Create(file);
            if (data != null)
            {
                mapGroupGroup[file] = new MeshGroupGroup(data);
            }
        }
#endif
    }
コード例 #4
0
 public static bool BufMeshGroup(string filename)
 {
     if (mapGroupGroup.ContainsKey(filename) == false)
     {
         //判断是HA角色 还是K角色
         var data = MeshGroupGroupDataHA.Create(filename);
         if (data == null)
         {
             data = MeshGroupGroupDataK.Create(filename);
         }
         if (data != null)
         {
             mapGroupGroup[filename] = new MeshGroupGroup(data);
         }
         else
         {
             Debug.Log("error:" + filename);
             return(false);
         }
     }
     return(mapGroupGroup[filename].BufMeshGroup());
 }
コード例 #5
0
    public KAnim.SpriteAni GetKAnim(string aniname)
    {
        MeshGroupGroupDataK kdata = group.data as MeshGroupGroupDataK;

        if (kdata != null)
        {
            if (namemap.ContainsKey(aniname))
            {
                return(kdata.GetSpriteAni(namemap[aniname]));
            }
            else
            {
                foreach (var name in kdata.GetAllAniname())
                {
                    string _name = name;
                    if (System.IO.Path.DirectorySeparatorChar == '/')
                    {
                        _name = _name.Replace('\\', '/');
                    }
                    _name = System.IO.Path.GetFileNameWithoutExtension(_name);
                    _name = System.IO.Path.GetFileNameWithoutExtension(_name).ToLower();
                    //Debug.Log("_________Ani:" + _name + " aniname:" + aniname + ", file" + name);
                    if (_name == aniname)
                    {
                        namemap[aniname] = name;
                        return(kdata.GetSpriteAni(name));
                    }
                    //if (name.ToLower().Contains(aniname))
                    //{
                    //    return kdata.GetSpriteAni(name);
                    //}
                }
            }
        }
        return(null);
    }