예제 #1
0
        public override void StartClientSide(ICoreClientAPI api)
        {
            this.capi = api;

            api.Input.RegisterHotKey("handbook", "Show VS Handbook", GlKeys.H, HotkeyType.GUIOrOtherControls);
            api.Input.SetHotKeyHandler("handbook", OnHelpHotkey);

            api.Event.LevelFinalize += Event_LevelFinalize;
            api.RegisterLinkProtocol("handbook", onHandBookLinkClicked);
            api.RegisterLinkProtocol("handbooksearch", onHandBookSearchLinkClicked);
        }
        private void OnLoaded()
        {
            if (capi != null && capi.World.Config.GetBool("allowMap", true))
            {
                capi.Input.RegisterHotKey("worldmaphud", Lang.Get("Show/Hide Minimap"), GlKeys.F6, HotkeyType.HelpAndOverlays);
                capi.Input.RegisterHotKey("worldmapdialog", Lang.Get("Show World Map"), GlKeys.M, HotkeyType.HelpAndOverlays);
                capi.Input.SetHotKeyHandler("worldmaphud", OnHotKeyWorldMapHud);
                capi.Input.SetHotKeyHandler("worldmapdialog", OnHotKeyWorldMapDlg);
                capi.RegisterLinkProtocol("worldmap", onWorldMapLinkClicked);
            }

            foreach (var val in MapLayerRegistry)
            {
                MapLayers.Add((MapLayer)Activator.CreateInstance(val.Value, api, this));
            }


            foreach (MapLayer layer in MapLayers)
            {
                layer.OnLoaded();
            }

            mapLayerGenThread = new Thread(new ThreadStart(() =>
            {
                while (!IsShuttingDown)
                {
                    foreach (MapLayer layer in MapLayers)
                    {
                        layer.OnOffThreadTick(20 / 1000f);
                    }

                    Thread.Sleep(20);
                }
            }));

            mapLayerGenThread.IsBackground = true;
            mapLayerGenThread.Start();
        }