// TODO: Move this to OnCreated when CO fixes the initial state position mismatch private void Initialize() { if (initialized) { return; } positionService.Chirper = chirperWrapper; positionService.DefaultPosition = chirperWrapper.builtinChirperPosition; positionService.UiView = ChirpPanel.instance.component.GetUIView(); NotificationSound = ChirpPanel.instance.m_NotificationSound; if (ModConfig.Instance.GetSetting <bool>(SettingKeys.Draggable)) { chirperWrapper.SetBuiltinChirperFree(true); if (ModConfig.Instance.GetSetting <int>(SettingKeys.ChirperPositionX) > 0) { var chirperX = ModConfig.Instance.GetSetting <int>(SettingKeys.ChirperPositionX); var chirperY = ModConfig.Instance.GetSetting <int>(SettingKeys.ChirperPositionY); var chirperPosition = new Vector2(chirperX, chirperY); positionService.UpdateChirperPosition(chirperPosition); } } var hideChirper = ModConfig.Instance.GetSetting <bool>(SettingKeys.HideChirper); chirperWrapper.ShowBuiltinChirper(!hideChirper); initialized = true; }
public override void OnCreated(IChirper c) { //Init currentUIView = ChirpPanel.instance.component.GetUIView(); currentCam = currentUIView.uiCamera; ChirpPanel.instance.component.BringToFront(); currentChirper = c; currentChirper.SetBuiltinChirperFree(true); currentChirperPos = currentChirper.builtinChirperPosition; defaultChirperPos = currentChirper.builtinChirperPosition; SetScreenRes(); SetGUISize(); if (!LoadSavedPosition()) { UpdateAnchor(); } }