public static void Load() { FileTable.FileTableEnabled = true; // Load all the name maps into the registry if (StatusMessage != null) { StatusMessage("Loading Key Name Maps..."); } KeyNameReg.RefreshKeyNameMaps(); // Load all the available jazz graphs into their manager if (StatusMessage != null) { StatusMessage("Searching for Jazz Graph Resources..."); } JazzManager = ResourceMgr.GetResourceManager(kJazzTID); JazzManager.LoadAll(); // Load all the available animations into their manager if (StatusMessage != null) { StatusMessage("Searching for Animation Resources..."); } ClipManager = ResourceMgr.GetResourceManager(kClipTID); ClipManager.LoadAll(); // Close all open package file streams after loading if (StatusMessage != null) { StatusMessage("Closing Package Filestreams..."); } FileTableExt.Reset(); FileTableExt.CloseCustomContent(); FileTable.Reset(); }
//player level up particle effect private void PlayerLevelUp() { //level up effect ResourceMgr.GetInstance().LoadAsset("ParticleProps/Player_LvUp", true, this.transform); //audio AudioManager.PlayAudioEffectA("LevelUp"); }
void Start() { float a = Profile.ProfileBegin(); ms_luaMgr = LuaScriptMgr.Instance; ms_resourceMgr = ResourceMgr.Instance; ms_sceneMgr = SceneMgr.Instance; ms_uiMgr = UIMgr.Instance; ms_resourceMgr.Init(); Profile.ProfileEnd("Mgr To Instance", a); a = Profile.ProfileBegin(); ms_sceneMgr.Init(); Profile.ProfileEnd("sceneMgr.Init", a); a = Profile.ProfileBegin(); ms_uiMgr.Init(); Profile.ProfileEnd("ms_uiMgr.Init", a); a = Profile.ProfileBegin(); ms_luaMgr.Init(); Profile.ProfileEnd("luaMgr.Init", a); ms_luaMgr.PrintLuaUsedMem(); InitSDKEntry(); }
public UIFrameRenderer(Configs configs, Models models, ResourceMgr resources) { this.localController = Component.FindObjectOfType <UIFrameController>(); this.localController.Inject(this, configs, models); this.resources = resources; this.configs = configs; }
public void AddBrick(String name, Vector3 loc_StartPot, Vector3 moveSpan, int moveDelay) { // GameObject go = GameObject.Instantiate (Block.GetCloneBrick ()) as GameObject; GameObject go = ResourceMgr.Instance().CreateBrick(ResourceMgr.TYPE_EMPTY); go.name = name; go.transform.parent = this.transform; Brick brick = go.AddComponent <Brick> (); brick.M_GO = go; brick.M_Parent = this; brick.M_Loc_StartPot = loc_StartPot; brick.M_MoveSpan = moveSpan; brick.M_Loc_CurPot = brick.M_Loc_StartPot; brick.M_MoveDelay = moveDelay; brick.M_GO.SetActive(true); // brick.ActiveMoveCondition =IsMoveOver; brick.M_MoveActiveConditionType = MoveActiveConditionType.PARENT_MOVE_OVER; brick.M_MoveDuration = 1f; m_Bricks.Add(brick); // Material tmp = new Material (brick.M_GO.GetComponent<Renderer> ().material);// .sharedMaterial); // tmp.color = BrickColor.GetRandomColor ().C; // brick.M_GO.GetComponent<Renderer> ().material = tmp; }
private void StartFight() { //第一符卡,播放收放特效(关卡中途加入的boss不需要) if (!CardMgr.IsSingleCard()) { PlayShirnkEffect(true); } //bossMark显示 UIBattle.SetBossMarkActive(true); //血条 var bossHpHudObj = ResourceMgr.Instantiate(ResourceMgr.LoadImmediately(BossHpBar)); bossHpHudObj.transform.SetParent(gameObject.transform, false); _bossHpHud = bossHpHudObj.GetComponent <UIBossHpComponent>(); _bossHpHud.Canvas.sortingOrder = SortingOrder.EnemyBullet + 1; _bossHpHud.Canvas.worldCamera = StageCamera2D.Instance.MainCamera; //boss背景 var circle = ResourceMgr.Instantiate(ResourceMgr.LoadImmediately(BossHpCircle)); circle.transform.SetParent(gameObject.transform, false); _bossCircle = circle.GetComponent <UIBossCircleComponent>(); //bossCard DOVirtual.DelayedCall(1F, CardMgr.OnStartFight, false); //禁止无敌 Invisible = false; //场景卷轴恢复 StageSceneBase.RevertSpeed(); }
/// <summary> /// 현재의 모델 하위에 newPrefname를 읽어서 메쉬들을 다 적용시켜준다. /// </summary> /// <param name="newPrefname">추가로 적용될 프리펩이름</param> public bool ModelApply(string newPrefname) { //Object prefeb = Resources.Load(newPrefname); GameObject prefeb = ResourceMgr.Load(newPrefname) as GameObject; if (prefeb == null) { Debug.LogWarning(string.Format("ModelApply-NotFoundPref: {0}", newPrefname)); return(false); } GameObject newData = (GameObject)Instantiate(prefeb); //if (newData == null) //{ // return false; //} SkinnedMeshRenderer[] BonedObjects = newData.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer smr in BonedObjects) { ProcessBonedObject(smr); } //읽어온 새 데이터 삭제 Destroy(newData); return(true); }
public void SetInfo() { ///设置已签到的对象 foreach (var data in PlayerData.Signs) { GameObject signItem = singIned[data.signId.ToString()]; ResourceMgr.CreateUIPrefab("GUIs/SignIn/siged", signItem.transform); Utility.FindChild <Button>(signItem.transform, "icon").interactable = false; } ///设置过期对象 for (int i = 0; i < TimeSystem.GetCurrentDay - 1; i++) { GameObject signItem = signs[i]; if (signItem.transform.childCount == 3) { ResourceMgr.CreateUIPrefab("GUIs/SignIn/passed", signs[i].transform); Utility.FindChild <Button>(signItem.transform, "icon").interactable = false; } } GameObject today = signs[TimeSystem.GetCurrentDay - 1]; ResourceMgr.CreateUIPrefab("GUIs/SignIn/SignInSelect", today.transform); for (int i = TimeSystem.GetCurrentDay; i < TimeSystem.DaysInMonth(); i++) { GameObject signItem = signs[i]; Utility.FindChild <Button>(signItem.transform, "icon").interactable = false; } }
/// <summary> /// 实例化角色预制体时创建 /// </summary> public virtual void OnInstanciateObject() { _gameObject = ResourceMgr.InstantiateGameObject(ResPath); gameObject.name = GetType().Name; //自动添加PersonIdentity var id = gameObject.GetOrAddComponent <PersonIdentity>(); id.abstractPerson = this; id.onUpdate += Update; gameObject.SetActive(false); //反射添加人物控制脚本 var controllerTypeAttribute = GetType().GetAttribute <UsePersonControllerAttribute>(); if (controllerTypeAttribute != null) { _controller = (AbstractPersonController)gameObject.GetOrAddComponent(controllerTypeAttribute.controllerType); // Debug.Log(controllerTypeAttribute.controllerType); _controller.InitController(this); } // Debug.Log(CharacterName + " Init"); Assert.IsTrue(_controller); }
//预加载窗口物体进缓存 public void InitWindowCache(PEWindowEnum windowEnum, ResType resType, string luaName = "", ResCacheType cacheType = ResCacheType.Never) { PWindow pwindow = new PWindow(windowEnum, luaName); string windowName = pwindow.windowName; GameObject gb = null; if (!windowDic.ContainsKey(pwindow)) { gb = (GameObject)ResourceMgr.GetInstantiateOB(windowName, resType, cacheType); gb.name = windowName; gb.transform.parent = windowRootTrans; gb.transform.localPosition = Vector3.zero; gb.transform.localScale = Vector3.one; NGUITools.SetActive(gb, false); WindowBase windowBase = gb.GetComponent <WindowBase>(); if (windowBase == null) { windowBase = GetOrAddWindowHandle(gb, windowEnum, luaName); if (windowBase == null) { Debug.LogError("Can not Get " + windowName + " Handle Scripts"); return; } } windowDic.Add(pwindow, new PWindowType(windowBase, resType, cacheType)); windowBase.InitDic(); } }
// Use this for initialization void Start() { mRes = ResourceMgr.Instance; mRes.Load("Prefabs/Sphere"); mRes.Load("Prefabs/unitychan"); }
void Explode() { gameObject.SetActive(false); exp = GameObject.Instantiate(ResourceMgr.Instance().GetResFromName(ConstValue.GAME_BOMB_EXP), transform.position, Quaternion.identity) as GameObject; ParticleSystem ps = exp.GetComponent <ParticleSystem>(); ps.Play(); Invoke("DestoryExp", 1f); List <ComBox> neighborBoxs = BoxManager.GetInstance().GetNeighborBoxs(box); box.Explode(); foreach (ComBox comBox in neighborBoxs) { comBox.Explode(); } GamePlaying.Instance().boxPanel.CheckPanelState(); GamePlaying.Instance().boxPanel.BackMoveSpeed(); GamePlaying.Instance().isPlaying = true; GamePlaying.Instance().boxPanel.m_CanTouch = true; GamePlaying.Instance().boxPanel.isUsingProp = false; GamePlaying.Instance().boxPanel.usingPropID = GamePropsId.None; Messenger.Broadcast(ConstValue.MSG_USE_PROP_SUC, GamePropsId.Bomb); }
private void InitItemList() { GameObject itemObj; foreach (var id in itemIdList) { var itemInfo = CsvMgr.GetData <ItemData>(id); itemObj = ResourceMgr.InstantiateGameObject(UiName.Image_ItemBk, this.itemList); Assert.IsTrue(itemObj); var avator = itemObj.transform.Find("Image_ItemAvator"); if (avator == null) { throw new Exception("avator is null"); } var image = avator.GetComponent <Image>(); if (image == null) { throw new Exception("Image is null"); } image.sprite = ResourceMgr.GetAsset <Sprite>(itemInfo.spriteName); itemObj.transform.Find("Tmp_Price").GetComponent <TextMeshProUGUI>().text = itemInfo.price.ToString(); this.items.Add(itemObj); } }
/// <summary> /// 粒子特效加载的公共方法(重载) /// 更好的方式:使用对象缓冲池技术 /// </summary> /// <param name="PEName">粒子特效的名字</param> /// <param name="parentTra">父对象的位置</param> /// <param name="position">生成位置</param> /// <param name="quaternion">生成方向</param> /// <param name="destroyTime">等待销毁时间</param> /// <param name="isCatch">是否缓存</param> /// <param name="strAudioEffect">播放的音频剪辑</param> /// <returns></returns> protected IEnumerator LoadParticalEffect(string PEName, Transform parentTra, Vector3 position, Quaternion quaternion, float createTime = 0.02f, float destroyTime = 10f, bool isCatch = true, string strAudioEffect = null) { // 间隔时间 yield return(new WaitForSeconds(createTime)); //提取的粒子预设 GameObject goParticalPrefab = ResourceMgr.GetInstance().LoadAsset(PEName, isCatch); //设置父子对象 if (parentTra != null) { goParticalPrefab.transform.parent = parentTra; } //设置特效的生成位置 goParticalPrefab.transform.position = position; //设置特效的生成方向(粒子预设的旋转) goParticalPrefab.transform.rotation = quaternion; //可选:播放特效音频(这里调用的方法,应该和主角音效播放调用的方法不同) AudioManager.PlayAudioEffectB(strAudioEffect); //定义销毁时间 if (destroyTime > 0) { Destroy(goParticalPrefab, destroyTime); } }
/// <summary> /// 生成敌人(加入对象缓冲池技术) /// </summary> /// <param name="enemy">生成的敌人的预置体</param> /// <param name="spawnNum">生成敌人的数量</param> /// <param name="spawnTras">生成地点数组</param> /// <param name="isRaodom">是否随机生成(未写好)</param> /// <param name="hasHPBar">是否挂载血条</param> /// <returns></returns> public IEnumerator SpawnEnemy(GameObject enemy, int spawnNum, Transform[] spawnTras, bool isRaodom = true, bool hasHPBar = true) { yield return(new WaitForSeconds(1f)); for (int i = 1; i <= spawnNum; i++) { //克隆的对象 GameObject goClone; //定义克隆体随机出现的位置 Transform traEnemySpawnPosition = GetRandomEnemySpawnPosition(spawnTras); //在“对象缓冲池“”中激活指定的对象 //***待优化:随机旋转,或者面向玩家出现*** goClone = PoolManager.PoolsArray["_Enemys"].GetGameObject(enemy, traEnemySpawnPosition.position, Quaternion.identity); //如果需要挂载血条 if (hasHPBar) { //调用预设 GameObject goEnemyHP = ResourceMgr.GetInstance().LoadAsset("Prefabs/UI/UI_Enemy_HPBar", true); //确定父节点 goEnemyHP.transform.parent = GameObject.FindGameObjectWithTag("Tag_UIPlayerInfo").transform; //参数赋值 goEnemyHP.GetComponent <Enemy_HPBar>().SetTargetEnemy(goClone); } yield return(new WaitForSeconds(2f)); } }
public AboutBox() { InitializeComponent(); // Initialize the AboutBox to display the product information from the assembly information. // Change assembly information settings for your application through either: // - Project->Properties->Application->Assembly Information // - AssemblyInfo.cs this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; CreateAbbreviatedLinkText(labelWebsiteURL, ProjectUrls.PROJECT_HOME); CreateAbbreviatedLinkText(labelDocumentationURL, ProjectUrls.USER_GUIDE); CreateAbbreviatedLinkText(labelAppDataDirPath, ResourceMgr.ApplicationSpecificApplicationData()); CreateAbbreviatedLinkText(labelExePath, Path.GetDirectoryName(Application.ExecutablePath)); this.textBoxDescription.Text = string.Format("{0}; version {1}", AssemblyDescription, AssemblyVersion) + nl + nl + "========= Regional Settings =========" + nl + "Input Language: " + InputLanguage.CurrentInputLanguage.Culture.Name + nl + "Current Culture: " + CultureInfo.CurrentCulture.Name + nl + "Current UI Culture: " + CultureInfo.CurrentUICulture.Name + nl + nl + "========= Assemblies loaded (so far) =========" + nl + string.Join(nl, InstalledAssemblies.Assemblies.ToArray()); }
public GameObject BindEffect(string sDummy, string sEffect, float nZoomRate, float fDecTime) { Transform oDummy = GetDummyFromCache(sDummy); if (!oDummy) { DebugMsg("BindEffect wrong sDummy:" + m_sName + "," + sDummy); return(null); } GameObject oEffectObj = ResourceMgr.LoadAssetEx(sEffect, false); if (!oEffectObj) { DebugMsg("BindEffect wrong sEffect:" + sEffect); return(null); } oEffectObj.SetActive(false); Transform oEffectTrans = oEffectObj.transform; oEffectTrans.SetParent(oDummy); oEffectTrans.localPosition = Vector3.zero; oEffectTrans.localRotation = new Quaternion(0.0f, 0.0f, 0.0f, 0.0f); oEffectTrans.localScale = Vector3.one; UIMgr.ApplyParentLayer(oEffectObj); DealFixedRotation(oEffectObj); oEffectObj.SetActive(true); return(oEffectObj); }
public BattlePanelView() { GameObject UIRootCanvas = GameObject.Find("UIRootCanvas"); // GameObject UICamera = UIRootCanvas.transform.FindChild("UICamera").gameObject; view = ResourceMgr.GetGameObject(URLConst.GetUI(UIType.battle.Name)); view.transform.SetParent(UIRootCanvas.transform); view.transform.localPosition = new Vector3(0, 0, 0); view.transform.localScale = new Vector3(1, 1, 1); m_battleSkillUI = new BattleSkillUI(); GameObject cardbtn = view.transform.FindChild("Image").gameObject; UIEventHandlerBase.AddListener(cardbtn, UIEventType.ON_POINTER_DOWN, delegate(GameObject arg1, BaseEventData arg2){ Debug.Log("point down!!!!!!!!"); // SceneMgr.Instance.GetCurSceneView().addMonster(100101); }); UIEventHandlerBase.AddListener(cardbtn, UIEventType.ON_POINTER_UP, delegate(GameObject arg1, BaseEventData arg2){ Debug.Log("point Up!!!!!!!!"); GameObject m_CurSceneGO = SceneManager.GetActiveScene().GetRootGameObjects()[0]; Vector3 pos = m_CurSceneGO.transform.FindChild("Camera").GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition); // SceneMgr.Instance.GetCurSceneView().addMonster(100101, new Vector3(pos.x, pos.y, 0)); CreateAction action = new CreateAction(pos); LockStepMgr.Instance.AddAction(action); }); }
public void IReset() { Reset(); Rigidbody rg = GetComponent <Rigidbody> (); if (rg != null) { GameObject.Destroy(rg); } transform.localRotation = Quaternion.identity; GetComponent <Collider> ().material = ResourceMgr.Instance().m_Ice_PMtl; if (m_IsCoin) { // GetComponent<Renderer> ().material = ResourceMgr.Instance ().m_BrickMtls [ResourceMgr.MTL_ID_EMPTY]; SetBrickChild(); } if (m_MagnetController != null) { ResourceMgr.Instance().FreeMagnetController(m_MagnetController); m_MagnetController = null; } m_AttachMagnet = false; m_IsCoin = false; m_IsCoinAbsorbed = false; m_OnUnbeatableCollided = false; }
public void CreateSignItems() { int count = 1; foreach (var sign in ConfigInfo.Instance.SignIn) { if (count > days) { break; } var sg = ResourceMgr.CreateUIPrefab("GUIs/SignIn/SignIn", layout); sg.name = sign.Key.ToString(); signs.Add(sg); singIned.Add(sign.Key, sg); Button btn = Utility.FindChild <Button>(sg.transform, "icon"); btn.onClick.AddListener(() => { SendSignedRequest(Convert.ToInt32(sg.name)); }); string Icon = ConfigInfo.GetProp(ConfigInfo.Instance.GetPropId(sign.Key, days)).Icon; btn.GetComponent <Image>().sprite = ResourceMgr.Load <Sprite>("Sprites/Props/" + Icon); Utility.FindChild <Text>(sg.transform, "num").text = ConfigInfo.Instance.GetNum(sign.Key, days).ToString(); Utility.FindChild <Text>(sg.transform, "day").text = count.ToString(); count++; } }
static SpawnController getSpawnController() { GameObject obj = GameObject.Find("SpawnController"); if (G_GameInfo.GameMode == GAME_MODE.SINGLE) { //SingleGameInfo stageinfo = (SingleGameInfo)G_GameInfo.GameInfo; DungeonTable.StageInfo stage = _LowDataMgr.instance.GetStageInfo(SingleGameState.lastSelectStageId); if (stage.type == 2) { obj = GameObject.Find("SpawnController_Hard"); } } SpawnController[] spawnCtlrs = obj.GetComponentsInChildren <SpawnController> (); //SpawnController[] spawnCtlrs = GameObject.FindObjectsOfType<SpawnController>(); SpawnController _spawnCtlr; if (null == spawnCtlrs || 0 == spawnCtlrs.Length) { _spawnCtlr = ResourceMgr.InstAndGetComponent <SpawnController>("MapComponent/SpawnController"); } else { _spawnCtlr = spawnCtlrs[0]; } return(_spawnCtlr); }
/// <summary> /// 加载某个csv /// </summary> public static CsvFile Load(string csvName) { try { // 载入资源 string assetPath = ConfigMgr.ETC_PATH + "/" + csvName + CSV_EXT; byte[] csvBytes = ResourceMgr.LoadByte(assetPath); // 资源不存在 if (csvBytes == null || csvBytes.Length == 0) { return(null); } // 反序列化 MemoryStream csvStr = new MemoryStream(csvBytes, 0, csvBytes.Length, true, true); CsvFile csv = CsvFileMgr.Deserialize(csvStr); csvStr.Close(); // 返回数据 return(csv); } catch (Exception e) { //LogMgr.Trace(e.Message); return(null); } finally { // do something } }
public void Init() { if (_lock == null) { _lock = new Object(); } m_level = GamePlaying.Instance().currentLevel; m_resource = ResourceMgr.Instance(); speed = 0.005f; moveSpeed = -speed; canLink = true; isLoadDone = false; usingPropID = GamePropsId.None; isUsingProp = false; m_CanTouch = true; boxPanelW = m_level.width * ConstValue.BoxWidth; boxPanelH = m_level.height * ConstValue.BoxHeight; Debug.Log("boxPanelWH:" + boxPanelW + "," + boxPanelH); transform.position = new Vector3(0, ScreenInfo.h / 2 - ConstValue.BoxHeight * visibleRow + boxPanelH / 2, 0); background = Instantiate(m_resource.GetResFromName(ConstValue.GAME_BACKGROUND), new Vector3(10f, 10f, 0), Quaternion.identity) as GameObject; background.transform.parent = transform; boxManager = BoxManager.GetInstance(); boxManager.Init(); bottomRow = m_level.height - 1; InitBoxs(bottomRow, visibleRow); GetBottomBox(); }
protected void lnkbtnAddMore_Click(object sender, EventArgs e) { lnkbtnAddSetting.Visible = true; lnkbtnAddMore.Visible = false; lnkbtnCancelSetting.Visible = true; // ddlstakeholderTypeListfooter.Visible = true; ddlTireSizeListfooter.Visible = true; txteffectivedatefooter.Visible = true; txtexpirationdatefooter.Visible = true; txtDollarValuefooter.Visible = true; //System.Data.SqlClient.SqlParameter[] prm; //prm = new System.Data.SqlClient.SqlParameter[1]; //prm[0] = new System.Data.SqlClient.SqlParameter("@OrganizationTypeId", Convert.ToInt32(OrganizationType.Stakeholder)); // Utils.GetLookUpData<DropDownList>(ref ddlstakeholderTypeListfooter, LookUps.LoadStakeholderTypes, LanguageId); ddlTireSizeListfooter.Items.Clear(); ddlTireSizeListfooter.DataValueField = "SizeId"; ddlTireSizeListfooter.DataTextField = "TireSize"; ddlTireSizeListfooter.DataSource = PTE.GetAllSizes(); ddlTireSizeListfooter.DataBind(); ddlTireSizeListfooter.Items.Insert(0, new ListItem(ResourceMgr.GetMessage("Select"), "0")); ScriptManager.RegisterStartupScript(this, GetType(), "AddDataPickerFooter", "SetDatePicket();", true); }
public FrisbeeFactory(Configs configs, Models models, ResourceMgr resources) { this.pool = new Queue <FrisbeeRenderer>(); this.configs = configs; this.resources = resources; this.models = models; }
partial void OnLoad() { //do any thing you want unick = view["Top/Uinfo/NickText"].GetComponent <Text>(); uface = view["Top/Uinfo/HeadIcon"].GetComponent <Image>(); coinText = view["Top/Center/CoinInfo/Text"].GetComponent <Text>(); diamondText = view["Top/Center/DamdInfo/Text"].GetComponent <Text>(); expSlider = view["Top/Uinfo/ExpSlider"].GetComponent <Slider>(); levelText = view["Top/Uinfo/LevelText"].GetComponent <Text>(); expText = view["Top/Uinfo/ExpText"].GetComponent <Text>(); add_button_listener("Top/Uinfo/HeadIcon", OnClickIcon); add_button_listener("Pages/HomePage/Left/Top/Flag/LoginBonuesBtn", () => { var _loginBonuesUi = ResourceMgr.InstantiateGameObject(UiName.LoginBonues, GlobalVar.G_Canvas.transform).GetComponent <LoginBonuesUi>(); _loginBonuesUi.ShowLoginBonues(NetInfo.gameInfo.days); }); add_button_listener("Pages/WarPage/Framework/Maps/SgydBtn", () => { ResourceMgr.InstantiateGameObject( UiName.MatchDlgUi, m_TransFrom); NetInfo.SetZoneId(ZoneId.Sgyd); }); add_button_listener("Pages/WarPage/Framework/Maps/AssyBtn", () => { ResourceMgr.InstantiateGameObject( UiName.MatchDlgUi, m_TransFrom); NetInfo.SetZoneId(ZoneId.Assy); }); }
public void ModelLoad() { ModelReset(); GameObject oriUnit = ResourceMgr.Load(string.Format("Character/Prefab/{0}", bodymodel.text)) as GameObject; if (oriUnit == null) { Debug.LogWarning("not found player model error! path = Character/Prefab/" + bodymodel.text); oriUnit = ResourceMgr.Load(string.Format("Etc/Missing_Model")) as GameObject; GameObject _ErrorUnit = GameObject.Instantiate(oriUnit) as GameObject; } GameObject _myUnit = GameObject.Instantiate(oriUnit) as GameObject; ModelModifier Modifier = _myUnit.AddComponent <ModelModifier>(); // 여기까지 베이스모델 로딩완료 머리/무기를 붙이자 if (!headmodel.text.Equals("")) { Modifier.ModelApply(string.Format("Character/Prefab/{0}", headmodel.text)); } if (!weaponmodel.text.Equals("")) { Modifier.ModelApply(string.Format("Character/Prefab/{0}", weaponmodel.text)); } _myUnit.transform.parent = ModelRoot.transform; }
public void ModelLoad() { ModelReset(); GameObject oriUnit = ResourceMgr.Load(string.Format("Character/Prefab/{0}", bodymodel.text)) as GameObject; if (oriUnit == null) { Debug.LogWarning("not found player model error! path = Character/Prefab/" + bodymodel.text); oriUnit = ResourceMgr.Load(string.Format("Etc/Missing_Model")) as GameObject; GameObject _ErrorUnit = GameObject.Instantiate(oriUnit) as GameObject; } GameObject _myUnit = GameObject.Instantiate(oriUnit) as GameObject; ModelModifier Modifier = _myUnit.AddComponent <ModelModifier>(); // 여기까지 베이스모델 로딩완료 머리/무기를 붙이자 if (!headmodel.text.Equals("")) { Modifier.ModelApply(string.Format("Character/Prefab/{0}", headmodel.text)); } if (!weaponmodel.text.Equals("")) { Modifier.ModelApply(string.Format("Character/Prefab/{0}", weaponmodel.text)); } _myUnit.transform.parent = ModelRoot.transform; //_myUnit.layer = 8; NGUITools.SetLayer(_myUnit, 8); _myUnit.transform.localPosition = Vector3.zero; _myUnit.transform.localScale = new Vector3(180f, 180f, 180f); _myUnit.transform.localEulerAngles = new Vector3(0f, 180f, 0f); }
/// <summary> /// 根据id实例化一个Prefab /// </summary> /// <param name="id"></param> /// <param name="parent"></param> /// <returns></returns> public static GameObject InstantiateGoByID(int id, GameObject parent) { ResourceMgr resourceMgr = ResourceMgr.GetInstance(); GameObject prefab = null; if (null != resourceMgr) { prefab = resourceMgr.GetResourceById <GameObject>(id); if (null == prefab) { return(null); } GameObject go = GameObject.Instantiate(prefab); if (null == go) { return(null); } go.name = prefab.name; if (null != parent) { go.transform.SetParent(parent.transform, false); } go.transform.localScale = prefab.transform.localScale; go.transform.localPosition = prefab.transform.localPosition; go.transform.localRotation = prefab.transform.localRotation; return(go); } else { Debug.LogWarning("检查资源管理器!"); return(null); } }
// Use this for initialization void Start() { Object o = ResourceMgr.Load("test1.lua"); TextAsset asset = o as TextAsset; lv.DoString(asset.text); }
static public int constructor(IntPtr l) { try { ResourceMgr o; o=new ResourceMgr(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
public static ResourceMgr Instance () { if (g_Instance == null) g_Instance = new ResourceMgr (); return g_Instance; }