// 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;
        }
예제 #2
0
        public void OnCreated(IChirper chirper)
        {
            // read config file for settings
            //MyConfig.LoadConfig ();

            BuiltinChirper = chirper;

            if (MyConfig.ConfigHolder.Config.DestroyBuiltinChirper)
            {
                chirper.ShowBuiltinChirper(false);
            }

            CreateBannerUI();
            theBannerPanel.SendToBack();
        }
예제 #3
0
        public void OnCreated(IChirper chirper)
        {
            // read config file for settings
            string configName = "ChirpBannerConfig.xml";

            CurrentConfig = MyConfig.Deserialize(configName);

            if (CurrentConfig == null)
            {
                CurrentConfig = new MyConfig();

                MyConfig.Serialize(configName, CurrentConfig);
            }
            // if old version, update with new
            else if (CurrentConfig.version == 0 || CurrentConfig.version < 4) // update this when we add any new settings
            {
                CurrentConfig.version = 4;
                MyConfig.Serialize(configName, CurrentConfig);
            }

            BuiltinChirper = chirper;

            if (CurrentConfig.DestroyBuiltinChirper)
            {
                chirper.ShowBuiltinChirper(false);
            }

            CreateBannerConfigUI();
            CreateBannerUI();

            if (mmb == null)
            {
                UIView uiv = UIView.GetAView();

                if (uiv != null && uiv.gameObject != null)
                {
                    mmb = uiv.gameObject.AddComponent <MyMonoB>();
                    mmb.transform.parent = uiv.transform;
                }
            }
        }