void CreateMenu(VehiclePart.Location Type) { Transform NewParent = null; switch (Type) { case VehiclePart.Location.Front: NewParent = Tabs[1].transform; break; case VehiclePart.Location.Middle: NewParent = Tabs[2].transform; break; case VehiclePart.Location.End: NewParent = Tabs[3].transform; break; } int Len = CM.VC.Config.InstallableParts.Count; int YCount = 0; for (int i = 0; i < Len; i++) { if (CM.VC.Config.InstallableParts[i].PartLocation == Type) { GameObject NewOption = Instantiate(PartOptionPrefab, Vector3.zero, Quaternion.identity); NewOption.transform.SetParent(NewParent); RectTransform RT = NewOption.GetComponent <RectTransform>(); RT.transform.localScale = Vector3.one; RT.anchoredPosition = new Vector2(0f, (YCount * -35f) + 70f); //CM.VC.Config.InstallableParts[i] <- old when VP instead of int index NewOption.GetComponent <PartOption>().Init(this, CM.VC.Config.InstallableParts[i].PartName, i, CM.VC.Config.InstallableParts[i].Cost.ToString()); YCount++; } } GameObject EndOption = Instantiate(BackOptionPrefab, Vector3.zero, Quaternion.identity); EndOption.transform.SetParent(NewParent); RectTransform RTE = EndOption.GetComponent <RectTransform>(); RTE.transform.localScale = Vector3.one; RTE.anchoredPosition = new Vector2(0f, (YCount * -35f) + 70f); EndOption.GetComponent <ListEndOption>().Init(this); }
public void OpenTab(int Loc) //Open a tab duh { PartLoc = (VehiclePart.Location)Loc; SetScreen(Loc + 1); }