public override void OnLevelLoaded(LoadMode mode) { if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewMap && mode != LoadMode.LoadMap) { return; } _mode = mode; buildingWindowGameObject = new GameObject("buildingWindowObject"); var view = UIView.GetAView(); this.buildingWindow = buildingWindowGameObject.AddComponent <MapperWindow7>(); this.buildingWindow.transform.parent = view.transform; this.buildingWindow.position = new Vector3(300, 122); this.buildingWindow.Hide(); UITabstrip strip = null; if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame) { strip = ToolsModifierControl.mainToolbar.component as UITabstrip; } else { strip = UIView.Find <UITabstrip>("MainToolstrip"); } buttonObject = UITemplateManager.GetAsGameObject("MainToolbarButtonTemplate"); buttonObject2 = UITemplateManager.GetAsGameObject("ScrollablePanelTemplate"); menuButton = strip.AddTab("mapperMod", buttonObject, buttonObject2, new Type[] {}) as UIButton; menuButton.eventClick += uiButton_eventClick; }
public override void OnLevelLoaded(LoadMode mode) { if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewMap && mode != LoadMode.LoadMap) return; _mode = mode; buildingWindowGameObject = new GameObject("buildingWindowObject"); var view = UIView.GetAView(); this.buildingWindow = buildingWindowGameObject.AddComponent<MapperWindow7>(); this.buildingWindow.transform.parent = view.transform; this.buildingWindow.position = new Vector3(300, 122); this.buildingWindow.Hide(); UITabstrip strip = null; if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame) { strip = ToolsModifierControl.mainToolbar.component as UITabstrip; } else { strip = UIView.Find<UITabstrip>("MainToolstrip"); } buttonObject = UITemplateManager.GetAsGameObject("MainToolbarButtonTemplate"); buttonObject2 = UITemplateManager.GetAsGameObject("ScrollablePanelTemplate"); menuButton = strip.AddTab("mapperMod", buttonObject, buttonObject2, new Type[] { }) as UIButton; menuButton.eventClick += uiButton_eventClick; }