void selfInit() { filesPuppet.Clear(); TextureBlockMgr.InitOnce(); MeshGroupMgr.InitOnce(); foreach (var gg in MeshGroupMgr.mapGroupGroup) { filesPuppet.Add(gg.Key); } //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 // filesPuppet.Add(file); //} //filesPuppet.AddRange(_files); }
public void RupdateMesh() { TextureBlockMgr.InitOnce(); MeshGroupMgr.InitOnce(); collobj = null; if (KAniGenColl) { ClearKAniColl(); } updateMesh(); }
void selfInit(Com_Sprite sprite) { EditSprite = sprite; filesPuppet.Clear(); TextureBlockMgr.InitOnce(); MeshGroupMgr.InitOnce(); foreach (var gg in MeshGroupMgr.mapGroupGroup) { filesPuppet.Add(gg.Key); } }
//ha_ani_tool.hadata.puppetdata selectdata; void onSelectFile(string filename) { filesPuppetAnim.Clear(); filesPuppetAnimFail.Clear(); foreach (var ani in MeshGroupMgr.mapGroupGroup[filename].data.GetAllAniname()) { if (MeshGroupMgr.GetMeshGroup(filename, ani) != null) { filesPuppetAnim.Add(ani); } else { filesPuppetAnimFail.Add(ani); } } }
public void updateMesh() { //Debug.Log("pdata:" + puppetfile + "kcoll"+KAniUseController); group = MeshGroupMgr.GetMeshGroup(puppetfile, defaultanim); namemap.Clear(); if (KAniUseController) { anicontroller = null; InitKAni(); 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(); //Debug.Log("ani:" + _name); anicontroller.State(GetKAnim(_name).GetElement(null)); } updateAnim(0); //Debug.Log("Com_Sprite::updateMesh(" + (group != null) + ")"); }
public static void ClearAll() { TextureBlockMgr.ReInit(); MeshGroupMgr.Clear(); }
public void updateAnim(float delta) { if (anicontroller != null) { anicontroller.AdvTime(delta); //Debug.Log("aniname"+anicontroller.GetFrame().aniname); group = MeshGroupMgr.GetMeshGroup(puppetfile, anicontroller.GetFrame().aniname); int nframe = anicontroller.GetFrame().frameid; var frame = group.GetFrame(nframe); this.GetComponent <MeshFilter>().mesh = frame.mesh; var mats = frame.mats.ToArray(); this.GetComponent <MeshRenderer>().materials = mats; if (useColorBlend) { foreach (var m in mats) { if (useWhiteBlend) { if (m.shader.name != "clgc/nolit_gray") { m.shader = Shader.Find("clgc/nolit_gray"); } m.SetFloat("Gray", 0); m.SetFloat("White", blendWhite); } else { if (m.shader.name == "clgc/nolit_gray") { m.shader = Shader.Find("clgc/nolit"); } } m.color = colorBlend;//("Main Color", colorBlend); } } if (KAniGenColl) { //生成碰撞体 GenKAniColl(); } if (KAniSound) { PlayKAniSound(); } } else { //Debug.Log("Com_Sprite::updateAnim(" + (group != null) + ")"); if (group == null) { return; } // //动画帧更新 timer += delta; int nframe = (int)(timer * 30); while (nframe > group.maxFrame) { nframe -= (group.maxFrame + 1); timer = 0; } var frame = group.GetFrame(nframe); this.GetComponent <MeshFilter>().mesh = frame.mesh; var mats = frame.mats.ToArray(); this.GetComponent <MeshRenderer>().materials = mats; if (useColorBlend) { foreach (var m in mats) { m.color = colorBlend;//("Main Color", colorBlend); } } } }