public void LoadFavList(List <int> fav) { folderLevel = FolderLevel.CustomList; nodeItems.Clear(); AllNodeStrings.Clear(); foreach (int i in fav) { nodeItems.Add(TODV2.GetItemByID(i)); AllNodeStrings.Add(i.ToString() + ".prefab"); } ResetCurrentPage(); BuildNodes(); }
private void ReplacePH() { foreach (GameObject ph in placeholders) { DioramaObject dio = ph.GetComponent <DioramaObject>(); BundleItem t = TODV2.GetItemByID(dio.todID); string path = t.TopFolder.ToString() + @"\"; path += t.BundleName + @"\" + (t.FolderPath.Replace(",", @"\")) + @"\"; path += t.prefabName.Replace(".prefab", ""); path += " Rigged"; GameObject next = GameObject.Instantiate(Resources.Load(path, typeof(GameObject)), ph.transform.position, ph.transform.rotation, ph.transform.parent) as GameObject; ph.SetActive(false); } }
public void IControlUpdate() { manager.modeStringEnum = GameManager.ModeString.View_Mode; if (control.LB() && softSelected) { ignore.Add(softSelected); } if (control.RB()) { if (softSelected) { PickupSelected(); WorldBuilderMain.ChoosePlaceMode(); } return; } if (control.RHY() != 0) { Vector3 pos = manager.pointerGroup.localPosition; pos.y -= control.RHY() * Time.deltaTime / 4f; pos.z += control.RHY() * Time.deltaTime / 4f; manager.pointerGroup.localPosition = pos; } if (control.RB2()) { if (softSelected) { if (TODV2.GetItemByID(softSelected.GetComponent <DioramaObject>().todID).hasAnimation) { PickupSelected(); PoserMode.Instance().SetupMode(); return; } IWorldEvent iwe = softSelected.GetComponent <IWorldEvent>(); if (iwe != null) { iwe.StartEvent(WorldBuilderMain.Instance()); return; } } } }
public void LoadZoneList() { folderLevel = FolderLevel.CustomList; nodeItems.Clear(); AllNodeStrings.Clear(); nodeItems.Add(TODV2.GetItemByID(14803)); AllNodeStrings.Add("New Zone.zone"); foreach (Zone z in WorldBuilderMain.currentWorld.zones) { nodeItems.Add(TODV2.GetItemByID(14803)); string s = z.zoneId + ":" + ((z.name == null || z.name.Length == 0) ? @"<No Name>" : z.name) + ".zone"; AllNodeStrings.Add(s); } ResetCurrentPage(); BuildNodes(); }
IEnumerator RebuildGo(DioramaObjectSaver dos, Transform transform, bool addCollider = true) { GameObject go = null; if (dos.todID >= 0) { BundleItem t = TODV2.GetItemByID(dos.todID); string path = t.TopFolder.ToString() + @"\"; path += t.BundleName + @"\" + (t.FolderPath.Replace(",", @"\")) + @"\"; path += t.prefabName.Replace(".prefab", ""); if (t.loadFromResources) { go = GameObject.Instantiate(Resources.Load(path, typeof(GameObject))) as GameObject; } else { try { AssetBundle ab = AssetBundleManager.GetAssetBundle(t.BundleName).assetBundle; go = Instantiate(ab.LoadAsset(t.PrefabName, typeof(GameObject))) as GameObject; Common.ReassignTextures(go, t.HasLight); } catch (Exception e) { Debug.Log(t.prefabName + " ID: " + t.id + " failed to load -- " + e.StackTrace); } } Common.ReassignTextures(go, t.HasLight); go.name = "Object"; go.transform.parent = transform; go.transform.localPosition = dos.savedPos; go.transform.localRotation = dos.savedRot; go.transform.localScale = dos.savedScale; DioramaObject newDio = go.AddComponent <DioramaObject>(); newDio.todID = dos.todID; newDio.savedPos = dos.savedPos; newDio.savedRot = dos.savedRot; newDio.savedScale = dos.savedScale; newDio.gridScale = t.gridScale; newDio.layer = dos.layer == 0 ? 1 : dos.layer; Common.DestroyAll(go); CheckAnimation(go); List <CharPose> pose = dos.savedCharPose; Transform[] allTrans = go.GetComponentsInChildren <Transform>(); for (int i = 0; i < allTrans.Count(); i++) { CharPose next = pose[i]; allTrans[i].localPosition = next.savedPos; allTrans[i].localRotation = next.savedRot; } TextMeshPro tmp = go.GetComponentInChildren <TextMeshPro>(); if (tmp) { tmp.text = dos.text; } if (go.tag == "Untagged") { go.tag = "TableObject"; } //IEventScale ies = go.GetComponentInChildren<IEventScale>(); //if (ies != null) //{ // go.transform.localScale = Vector3.one; // for (int i = 0; i < dos.savedScale.x; i++) // { // ies.ScaleUp(); // } //} } yield return(null); }