public string GetCombineModel(uint model, uint avaterMotion, uint avaterDirection) { if (avaterMotion == 0 && avaterDirection == 0) { return(model.ToString()); } uint motion = (uint)avaterMotion; uint direction = (uint)avaterDirection; CSDirection d = (CSDirection)direction; if (avaterMotion == (uint)CSMotion.Dead) { d = CSDirection.Up; } if (d == CSDirection.Left) { d = CSDirection.Right; } else if (d == CSDirection.Left_Up) { d = CSDirection.Right_Up; } else if (d == CSDirection.Left_Down) { d = CSDirection.Right_Down; } direction = (uint)d; CSStringBuilder.Clear(); CSStringBuilder.Append(model.ToString(), "_", SFMisc.stringMotionDic.ContainsKey((int)motion) ? SFMisc.stringMotionDic[(int)motion] : "", "_", direction.ToString()); return(CSStringBuilder.ToString()); }
static int _m_ToString_xlua_st_(RealStatePtr L) { try { { var gen_ret = CSStringBuilder.ToString( ); LuaAPI.lua_pushstring(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
/// <summary> /// 从缓存池里面获得GameObject,并且从缓存池里面去除,返回的Gameobject.active = false /// </summary>resPath 资源路径,也是缓存池名称 /// <param name="poolName">资源路径</param> CSObjectPoolItem GetPoolItem(string resName, string resPath, EPoolType poolType, int poolNum = 0, bool isForever = false) { CSObjectPoolBase pool = null; string poolName = resPath; if (mDic.ContainsKey(poolName)) { pool = mDic[poolName]; } else { if (poolNum == 0) { return(null); } CSStringBuilder.Clear(); GameObject poolGO = new GameObject(); Transform trans = poolGO.transform; trans.parent = transform; if (poolType == EPoolType.Normal) { pool = poolGO.AddComponent <CSObjectPoolNormal>(); CSStringBuilder.Append("Normal Pool->", resName); poolGO.name = CSStringBuilder.ToString(); } else if (poolType == EPoolType.Resource) { pool = poolGO.AddComponent <CSObjectPoolAtlas>(); CSStringBuilder.Append("Atlas Pool->", resName); poolGO.name = CSStringBuilder.ToString(); } pool.resName = resName; //pool.resType = resType; pool.Init(this); mDic.Add(poolName, pool); mList.Add(pool); } pool.poolNum = poolNum; pool.poolName = poolName; pool.isForever = isForever; return(pool.GetGOFromPool()); }
/// <summary> /// 从缓存池里面获得GameObject,并且从缓存池里面去除,返回的Gameobject.active = false /// </summary>resPath 资源路径,也是缓存池名称 /// <param name="poolName">资源路径</param> private CSObjectPoolItem GetPoolItem(string resName, string resPath, EPoolType poolType, int poolNum = 0, bool isForever = false) { CSObjectPoolBase pool = null; string poolName = resPath; if (mDic.TryGetValue(poolName, out pool) && pool != null) { pool = mDic[poolName]; } else { if (poolNum == 0) { return(null); } CSStringBuilder.Clear(); GameObject poolGO = new GameObject(); Transform trans = poolGO.transform; trans.parent = transform; if (poolType == EPoolType.Normal) { pool = poolGO.AddComponent <CSObjectPoolNormal>(); CSStringBuilder.Append("Normal Pool->", resName); poolGO.name = CSStringBuilder.ToString(); } pool.resName = resName; //pool.resType = resType; pool.Init(); mDic[poolName] = pool; pool.transform.localScale = Vector3.zero; //mDic.Add(poolName, pool); mList.Add(pool); } pool.poolNum = poolNum; pool.poolName = poolName; pool.isForever = isForever; return(pool.GetGOFromPool()); }
public static string GetPath(string fileName, ResourceType LocalType, bool isLocal) { string path = ""; if (isLocal) { CSStringBuilder.Clear(); CSStringBuilder.Append(GetModelTypePath(LocalType), fileName); path = CSStringBuilder.ToString();//Resource.Load(存的是相对路径) } else { CSStringBuilder.Clear(); bool isAssetBundle = false; switch (LocalType) { case ResourceType.Map: case ResourceType.MiniMap: case ResourceType.Player: case ResourceType.PlayerAtlas: case ResourceType.Monster: case ResourceType.MonsterAtlas: case ResourceType.Npc: case ResourceType.NpcAtlas: case ResourceType.Weapon: case ResourceType.WeaponAtlas: case ResourceType.Effect: case ResourceType.EffectAtlas: case ResourceType.Skill: case ResourceType.SkillAtlas: case ResourceType.UIItem: case ResourceType.Audio: case ResourceType.Wing: case ResourceType.WingAtlas: case ResourceType.UIMountAtlas: case ResourceType.ScaleMap: case ResourceType.UIEffect: case ResourceType.UIWingTex: case ResourceType.UIPlayer: case ResourceType.UIWeapon: case ResourceType.SceneRes: case ResourceType.ResourceRes: { isAssetBundle = true; } break; } #if UNITY_EDITOR if (SFOut.IGame.IsLoadLocalRes) { if (string.IsNullOrEmpty(applicationDataPath)) { applicationDataPath = Application.dataPath; } if (UnityEditor.EditorUserBuildSettings.selectedBuildTargetGroup == UnityEditor.BuildTargetGroup.iOS) { path = applicationDataPath.Replace("Client/Branch/ClientIos/Assets", "Data/Branch/CurrentUseData/Normal/wzcq_ios/"); } else { path = applicationDataPath + "/../../Normal/wzcq_android/"; //path = applicationDataPath.Replace("Client/Branch/WZAndroidOrigin/Assets", "Data/Branch/CurrentUseData/Normal/wzcq_android/"); } path = CSStringBuilder.Append("file://", path, GetModelTypePath(LocalType), fileName, isAssetBundle ? assetbunldeStr : "").ToString(); } else { if (string.IsNullOrEmpty(applicationDataPath)) { applicationDataPath = Application.persistentDataPath; } path = CSStringBuilder.Append("file:///", applicationDataPath, "/", GetModelTypePath(LocalType), fileName, isAssetBundle ? assetbunldeStr : "").ToString(); } #else if (string.IsNullOrEmpty(applicationDataPath)) { applicationDataPath = Application.persistentDataPath; } path = CSStringBuilder.Append("file://", applicationDataPath, "/", GetModelTypePath(LocalType), fileName, isAssetBundle ? assetbunldeStr : "").ToString(); #endif } return(path); }