Exemplo n.º 1
0
 public override void ActivateWorldFuncButton()
 {
     UIHandler.SetMenu(UIHandler.worldEditConsole, true);
     ChatConsole.SendMessage("--------------------", Color.White);
     ChatConsole.SendMessage("Log on to nexus.games for assistance on building worlds and levels. You'll need to register an account to share your work online.", Color.Green);
     ChatConsole.SendMessage("--------------------", Color.White);
 }
Exemplo n.º 2
0
 private void SetMessage(string msg)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         _listMessages.Add("Recive: " + msg);
         ChatConsole.ScrollTo(msg, ScrollToPosition.End, false);
     });
 }
Exemplo n.º 3
0
 private void WebRtcControl_ErrorOccurred(object sender, ErrorEventArgs e)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         _listMessages.Add("Error: " + e);
         ChatConsole.ScrollTo(e, ScrollToPosition.End, false);
     });
 }
Exemplo n.º 4
0
 private void SetupRadegastGUI(RadegastInstance inst)
 {
     DLRConsole.AllocConsole();
     SetLoginButton("SetupCogbotGUI", false);
     DLRConsole.SafelyRun(() =>
     {
         chatConsole = new CogbotTabWindow(inst, this)
         {
             Dock    = DockStyle.Fill,
             Visible = false
         };
         tab             = inst.TabConsole.AddTab("cogbot", "Cogbot", chatConsole);
         tab.AllowClose  = false;
         tab.AllowDetach = true;
     });
     DLRConsole.SafelyRun(() =>
     {
         _simObjectsConsole = new SimObjectsConsole(inst, this)
         {
             Dock = DockStyle.Fill,
             // Visible = false
         };
         tab             = inst.TabConsole.AddTab("simobjects", "SimObjects", _simObjectsConsole);
         tab.AllowClose  = false;
         tab.AllowDetach = true;
     });
     DLRConsole.SafelyRun(() =>
     {
         RadegastTab tab1              = RadegastInstance.TabConsole.GetTab("chat");
         tab1.AllowDetach              = true;
         ChatConsole rchatConsole      = (ChatConsole)tab1.Control;
         rchatConsole.cbxInput.Enabled = true;
         rchatConsole.btnSay.Enabled   = true;
         //  rchatConsole.btnShout.Enabled = true;
         //RadegastTab tab3 = RadegastInstance.TabConsole.GetTab("search");
         //tab3.Control = new METAbolt.SearchConsole(inst);
         DLRConsole.SafelyRun(() =>
         {
             var sc = new METAbolt.SearchConsole(inst)
             {
                 Dock = DockStyle.Fill,
                 // Visible = false
             };
             tab             = inst.TabConsole.AddTab("cogbotsearch", "CogbotSearch", sc);
             tab.AllowClose  = false;
             tab.AllowDetach = true;
         });
     });
     if (TheBot.IsLoggedInAndReady)
     {
         RadegastInstance.Netcom.GetType().GetMethod("Network_LoginProgress",
                                                     BindingFlags.Instance | BindingFlags.NonPublic |
                                                     BindingFlags.Public)
         .Invoke(RadegastInstance.Netcom,
                 new object[]
                 { this, new LoginProgressEventArgs(LoginStatus.Success, "Cogbot already logged in", "") });
     }
 }
Exemplo n.º 5
0
        public FaceCommand(RadegastInstance instance)
            : base(instance)
        {
            Name = "face";
            Description = "Changes the direction";
            Usage = "face (direction|heading|object|person|help) [additional args] (type \"" + CommandsManager.CmdPrefix + "face help\" for full usage)";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 6
0
        public FollowCommand(RadegastInstance instance)
            : base(instance)
        {
            Name = "follow";
            Description = "Follows a person";
            Usage = "follow (person name|stop)";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 7
0
 public override void OnFirstOpen()
 {
     ChatConsole.Clear();
     ChatConsole.SendMessage("Welcome to the World Edit Console.", Color.White);
     ChatConsole.SendMessage("----------------------------------", Color.White);
     ChatConsole.SendMessage("This console allows you to alter the settings for your world campaign.", Color.White);
     ChatConsole.SendMessage("To open or close this console, press the tilde (~) key.", Color.OrangeRed);
     ChatConsole.SendMessage("This console can also be accessed from the tab menu.", Color.OrangeRed);
 }
Exemplo n.º 8
0
        public SitCommand(RadegastInstance instance)
            : base(instance)
        {
            Name = "sit";
            Description = "Sits on an object or on the ground";
            Usage = "sit (object name|ground)";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 9
0
        public FindCommand(RadegastInstance instance)
            : base(instance)
        {
            Name = "find";
            Description = "Finds nearby person or object";
            Usage = "find (object|person) name";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 10
0
        public FollowCommand(RadegastInstance instance)
            : base(instance)
        {
            Name        = "follow";
            Description = "Follows a person";
            Usage       = "follow (person name|stop)";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 11
0
        public SitCommand(RadegastInstance instance)
            : base(instance)
        {
            Name        = "sit";
            Description = "Sits on an object or on the ground";
            Usage       = "sit (object name|ground)";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 12
0
        public FindCommand(RadegastInstance instance)
            : base(instance)
        {
            Name        = "find";
            Description = "Finds nearby person or object";
            Usage       = "find (object|person) name";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 13
0
        public FaceCommand(RadegastInstance instance)
            : base(instance)
        {
            Name        = "face";
            Description = "Changes the direction";
            Usage       = "face (direction|heading|object|person|help) [additional args] (type \"" + CommandsManager.CmdPrefix + "face help\" for full usage)";

            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 14
0
        public GoCommand(METAboltInstance instance)
            : base(instance)
        {
            Name        = "go";
            Description = "Moves avatar";
            Usage       = "go [tp] (distance|xyz|object|person|help) [additional args] (type \"" + CommandsManager.CmdPrefix + "go help\" for full usage)";

            subCommand = new Regex(@"(?<subcmd>.*)\s*=\s*(?<subarg>.*)", regexOptions);
            Chat       = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 15
0
        public GoCommand(RadegastInstance instance)
            : base(instance)
        {
            Name = "go";
            Description = "Moves avatar";
            Usage = "go [tp] (distance|xyz|object|person|help) [additional args] (type \"" + CommandsManager.CmdPrefix + "go help\" for full usage)";

            subCommand = new Regex(@"(?<subcmd>.*)\s*=\s*(?<subarg>.*)", regexOptions);
            Chat = (ChatConsole)TC.Tabs["chat"].Control;
        }
Exemplo n.º 16
0
        public override void Load(BaseGame game)
        {
            if (!Host.IsPrimaryInstance)
            {
                Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
                Environment.Exit(0);
            }

            base.Load(game);

            if (args?.Length > 0)
            {
                Schedule(delegate { Beatmaps.Import(args); });
            }

            //attach our bindables to the audio subsystem.
            Audio.Volume.Weld(Config.GetBindable <double>(OsuConfig.VolumeGlobal));
            Audio.VolumeSample.Weld(Config.GetBindable <double>(OsuConfig.VolumeEffect));
            Audio.VolumeTrack.Weld(Config.GetBindable <double>(OsuConfig.VolumeMusic));

            Add(new Drawable[] {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes  = Axes.Both,
                    ActivateRequested = delegate { volume.Show(); }
                },
                intro   = new Intro(),
                Toolbar = new Toolbar
                {
                    OnHome           = delegate { MainMenu?.MakeCurrent(); },
                    OnSettings       = Options.ToggleVisibility,
                    OnPlayModeChange = delegate(PlayMode m) { PlayMode.Value = m; },
                },
                Chat   = new ChatConsole(API),
                volume = new VolumeControl
                {
                    VolumeGlobal = Audio.Volume,
                    VolumeSample = Audio.VolumeSample,
                    VolumeTrack  = Audio.VolumeTrack
                },
                new GlobalHotkeys //exists because UserInputManager is at a level below us.
                {
                    Handler = globalHotkeyPressed
                }
            });

            intro.ModePushed += modeAdded;
            intro.Exited     += modeRemoved;

            PlayMode = Config.GetBindable <PlayMode>(OsuConfig.PlayMode);
            PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
            PlayMode.TriggerChange();

            Cursor.Alpha = 0;
        }
Exemplo n.º 17
0
        public override void Run(string args, List <string> splitArgs)
        {
            int entityID    = -1;
            int entityCount = 1;

            if (splitArgs.Count == 0)
            {
                return;
            }

            if (!int.TryParse(splitArgs[0], out entityID))
            {
                string[] splitID = splitArgs[0].Split('.');

                if (splitID.Length < 2)
                {
                    ChatConsole.Error("If you specify the NPC by name rather than by ID you must precede it by either a mod's internal name or 'Vanilla' followed by a dot ('.'). e.x. \"Vanilla.TheDestroyer\"");
                    return;
                }

                string modName      = splitID[0];
                string entityName   = splitID[1];
                bool   isVanillaNpc = modName.ToLower() == "vanilla";

                try
                {
                    entityID = NpcDef.Defs[splitID[1], isVanillaNpc ? null : splitID[0]].Type;
                }
                catch (InvalidOperationException)
                {
                    ChatConsole.Error(isVanillaNpc ? "Could not find a vanila NPC with internal name '{0}'." : "Could not find an NPC with internal name '{0}' in the data of mod '{1}'.", splitID[1], splitID[0]);
                    return;
                }
            }

            if (splitArgs.Count > 1)
            {
                if (!int.TryParse(splitArgs[1], out entityCount))
                {
                    ChatConsole.Error("'{0}' is not a number.", splitArgs[1]);
                    return;
                }
            }

            for (int i = 0; i < entityCount; i++)
            {
                NPC.NewNPC((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, entityID);
            }
        }
Exemplo n.º 18
0
        public override void RunTick(WEScene scene)
        {
            if (UIComponent.ComponentWithFocus != null)
            {
                return;
            }

            // Left Mouse Button
            if (Cursor.LeftMouseState == Cursor.MouseDownState.Clicked)
            {
                WorldZoneFormat zone  = scene.currentZone;
                byte            gridX = (byte)Cursor.MiniGridX;
                byte            gridY = (byte)Cursor.MiniGridY;

                byte[] wtData = scene.worldContent.GetWorldTileData(zone, gridX, gridY);

                // If the wand clicked on a warp, then we can attempt to assign a warp link ID.
                if (NodeData.IsObjectAWarp(wtData[5]))
                {
                    UIHandler.SetMenu(UIHandler.worldEditConsole, true);
                    UIHandler.worldEditConsole.Open();
                    UIHandler.worldEditConsole.SendCommand("setWarp " + gridX.ToString() + " " + gridY.ToString() + " ", false);
                    ChatConsole.SendMessage("--------------------", Color.White);
                    ChatConsole.SendMessage("Assign a Link ID to this Warp Node. Must be a number between 1 and 20. Warps that share the same ID will link to each other. ", Color.Red);
                    ChatConsole.SendMessage("--------------------", Color.White);
                    ChatConsole.SendMessage("Example: setWarp " + gridX.ToString() + " " + gridY.ToString() + " 1", Color.Green);
                    ChatConsole.SendMessage("--------------------", Color.White);
                }

                // If the wand clicked on a node, then we can attempt to assign a level.
                if (NodeData.IsObjectANode(wtData[5], false, false, true))
                {
                    UIHandler.SetMenu(UIHandler.worldEditConsole, true);
                    UIHandler.worldEditConsole.Open();
                    UIHandler.worldEditConsole.SendCommand("setLevel " + gridX.ToString() + " " + gridY.ToString() + " ", false);
                    ChatConsole.SendMessage("--------------------", Color.White);
                    ChatConsole.SendMessage("Assign a Level ID to this Node. It can be any valid level, including official levels or levels created by other players. The original author will be credited with the level design.", Color.Red);
                    ChatConsole.SendMessage("--------------------", Color.White);
                    ChatConsole.SendMessage("Example: setLevel " + gridX.ToString() + " " + gridY.ToString() + " TUTORIAL_1", Color.Green);
                    ChatConsole.SendMessage("--------------------", Color.White);
                }
            }

            // Right Mouse Button (Clone Current Tile)
            else if (Cursor.RightMouseState == Cursor.MouseDownState.Clicked)
            {
                scene.CloneTile((byte)Cursor.MiniGridX, (byte)Cursor.MiniGridY);
            }
        }
Exemplo n.º 19
0
        public void Draw()
        {
            FontClass consoleFont = Systems.fonts.console;

            // Draw Console Background
            Systems.spriteBatch.Draw(Systems.tex2dBlack, new Rectangle(0, Systems.screen.viewHeight - 100, Systems.screen.viewWidth, Systems.screen.viewHeight), Color.Black * 0.85f);

            // Draw Console Text
            string consoleString = "> " + ConsoleTrack.instructionText;

            consoleFont.Draw(consoleString + (Systems.timer.UniFrame % 40 < 20 ? "|" : ""), 10, Systems.screen.viewHeight - 90, Color.White);

            // Draw Console Tab Highlight, if applicable
            if (ConsoleTrack.tabLookup.Length > 0)
            {
                // Determine length of current instruction line:
                Vector2 fontLen = consoleFont.font.MeasureString(consoleString);

                consoleFont.Draw(ConsoleTrack.tabLookup, 10 + (int)Math.Round(fontLen.X), Systems.screen.viewHeight - 90, Color.DarkSlateGray);
            }

            // Draw Console Help Text, if applicable.
            if (ConsoleTrack.helpText.Length > 0)
            {
                consoleFont.Draw(ConsoleTrack.helpText, 10, Systems.screen.viewHeight - 75, Color.Gray);
            }

            // Draw Console Possible Tab Options, if applicable.
            if (ConsoleTrack.possibleTabs.Length > 0)
            {
                consoleFont.Draw(ConsoleTrack.possibleTabs, 10, Systems.screen.viewHeight - 60, Color.DarkTurquoise);
            }

            // Draw Chat Console, if applicable.
            ChatConsole.Draw();
        }
Exemplo n.º 20
0
        public override void OnClick()
        {
            byte menuOpt = this.GetContextOpt(Cursor.MouseX, Cursor.MouseY);

            // World Tile Tool Options
            if (menuOpt <= 5)
            {
                WE_UI.curWESlotGroup = menuOpt;
                WETools.SetWorldTileToolBySlotGroup(WE_UI.curWESlotGroup);
                WETools.UpdateHelperText();
            }

            // Resize Option
            else if (menuOpt == 6)
            {
                UIHandler.worldEditConsole.Open();
                UIHandler.worldEditConsole.SendCommand("resize ", false);
                ChatConsole.SendMessage("--------------------", Color.White);
                ChatConsole.SendMessage("Resize the World Map", Color.Red);
                ChatConsole.SendMessage("--------------------", Color.White);
            }

            this.CloseMenu();
        }
Exemplo n.º 21
0
 public override void Run(string args, List <string> splitArgs)
 {
     ChatConsole.Error("Not yet implemented; PoroCYon is currently (supposedly) writing the lib for this...");
 }
Exemplo n.º 22
0
 public override void Dispose()
 {
     Objects = null;
     Chat    = null;
     base.Dispose();
 }
Exemplo n.º 23
0
 public override void Run(string args, List <string> splitArgs)
 {
     ChatConsole.Error("Will be implemented as soon as the debug variable system is created and implemented.");
 }
Exemplo n.º 24
0
    void Self_IM(object sender, InstantMessageEventArgs e)
    {
        // Note to self, if i do implement a dispatcher here these two need to be dispatched but not open
        // new IM tabs so don't treat the same as the rest below.
        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.StartTyping)
            return;

        if (e.IM.Dialog == OpenMetaverse.InstantMessageDialog.StopTyping)
            return;

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.GroupNoticeRequested)
            return;

        if (e.IM.Dialog == OpenMetaverse.InstantMessageDialog.InventoryOffered)
            return;

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.TaskInventoryOffered)
            return;

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.FriendshipOffered)
            return;

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.InventoryAccepted)
        {
            Gtk.Application.Invoke(delegate {
                MessageDialog md = new MessageDialog(MainClass.win, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, false,e.IM.FromAgentName + " accepted your inventory offer");
                md.Response += delegate { md.Destroy(); };
                md.ShowAll();
            });
            return;
        }

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.GroupNotice)
        {
            //Hmm need to handle this differently than a standard IM
            Gtk.Application.Invoke(delegate {
                MessageDialog md = new MessageDialog(MainClass.win,DialogFlags.DestroyWithParent,MessageType.Info,ButtonsType.Ok,false,"GROUP NOTICE\nFrom:"+e.IM.FromAgentName+"\n"+e.IM.Message);
                md.Response += delegate { md.Destroy(); };
                md.ShowAll();
            });
            return;
        }

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.GroupInvitation)
        {
            Gtk.Application.Invoke(delegate {
                MessageDialog md = new MessageDialog(MainClass.win,DialogFlags.DestroyWithParent,MessageType.Question,ButtonsType.YesNo,false,e.IM.FromAgentName+" has invited you to join a group\n"+e.IM.Message+"\nPress yes to accept or no to decline");
                md.Response += delegate(object o,ResponseArgs args)
                {
                    if(args.ResponseId==ResponseType.Yes)
                    {
                        MainClass.client.Self.InstantMessage(MainClass.client.Self.Name,e.IM.FromAgentID,"",e.IM.IMSessionID,InstantMessageDialog.GroupInvitationAccept,InstantMessageOnline.Offline,MainClass.client.Self.RelativePosition,MainClass.client.Network.CurrentSim.ID,null);
                    }
                    else
                    {
                        MainClass.client.Self.InstantMessage(MainClass.client.Self.Name,e.IM.FromAgentID,"",e.IM.IMSessionID,InstantMessageDialog.GroupInvitationDecline,InstantMessageOnline.Offline,MainClass.client.Self.RelativePosition,MainClass.client.Network.CurrentSim.ID,null);
                    }
                    md.Destroy();
         		};
                md.ShowAll();

                return;
            });
        }

        if(e.IM.Dialog==OpenMetaverse.InstantMessageDialog.RequestTeleport)
        {
            //Hmm need to handle this differently than a standard IM
            Gtk.Application.Invoke(delegate {
                MessageDialog md = new MessageDialog(MainClass.win, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, false,e.IM.FromAgentName + " would like you to join them\n" + e.IM.Message + "\nPress yes to teleport or no to ignore");
                md.Response += delegate(object o,ResponseArgs args)
                {
                    if(args.ResponseId==ResponseType.Yes)
                    {
                        MainClass.client.Self.TeleportLureRespond(e.IM.FromAgentID,true);
                    }
                    else
                    {
                        MainClass.client.Self.TeleportLureRespond(e.IM.FromAgentID,false);
                    }
                    md.Destroy();
                 };
                 md.ShowAll();
            });

            return;

        }

        if (e.IM.Dialog==InstantMessageDialog.MessageFromObject)
            return; //Its an object Im, chat will grab this for us

        if (im_windows.ContainsKey(e.IM.IMSessionID))
            return; // Do nothing handler is registered

        if(active_ims.Contains(e.IM.IMSessionID))
           return;

        //We only want the following stuff here for a new window create
        if (e.IM.Dialog != OpenMetaverse.InstantMessageDialog.MessageFromAgent &&
            e.IM.Dialog != OpenMetaverse.InstantMessageDialog.SessionSend &&
            e.IM.Dialog != OpenMetaverse.InstantMessageDialog.SessionGroupStart &&
            e.IM.Dialog != OpenMetaverse.InstantMessageDialog.BusyAutoResponse &&
            e.IM.Dialog != OpenMetaverse.InstantMessageDialog.SessionAdd
            )
        {
            return;
        }

        if (e.IM.BinaryBucket.Length>1)
        {
              Gtk.Application.Invoke(delegate {
                    ChatConsole imc=new ChatConsole(e.IM);
                    string lable;
                    lable=BytesToString(e.IM.BinaryBucket);
                    makeimwindow(lable, imc, true, e.IM.IMSessionID);
                    active_ims.Add(e.IM.IMSessionID);
            });
            return;
          		}

            lock (MainClass.win.im_queue)
            {
                if (im_windows.ContainsKey(e.IM.FromAgentID))
                    return; // Do nothing handler is registered

                im_queue.Add(e.IM);

                if (im_registering.Contains(e.IM.FromAgentID))
                    Logger.Log("Got 2nd IM when we are still processing window",Helpers.LogLevel.Debug);
                else
                {
                    im_registering.Add(e.IM.FromAgentID);
                    Gtk.Application.Invoke(delegate
                    {
                        ChatConsole imc = new ChatConsole(e.IM);

                        makeimwindow("Waiting...", imc, false, e.IM.FromAgentID);
                        active_ims.Add(e.IM.FromAgentID);
                    });
                }
            }
    }
Exemplo n.º 25
0
    public void startGroupIM(UUID id)
    {
        if(!active_ims.Contains(id))
        {
            ChatConsole imc=new ChatConsole(id,true);
            string lable;

            if(!MainClass.client.Groups.GroupName2KeyCache.TryGetValue(id,out lable))
                lable="Waiting...";

            makeimwindow(lable,imc,true,id);

            active_ims.Add(id);

        }
    }
Exemplo n.º 26
0
 public void startConfrenceIM(List<UUID> targets)
 {
     Gtk.Application.Invoke(delegate {
             ChatConsole imc=new ChatConsole(targets);
             makeimwindow("Confrence",imc,true,UUID.Zero);
         });
 }
Exemplo n.º 27
0
 public override void Dispose()
 {
     Chat = null;
     base.Dispose();
 }
Exemplo n.º 28
0
        protected override void Load(BaseGame game)
        {
            if (!Host.IsPrimaryInstance)
            {
                Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
                Environment.Exit(0);
            }

            base.Load(game);

            if (args?.Length > 0)
            {
                Schedule(delegate { Beatmaps.Import(args); });
            }

            //attach our bindables to the audio subsystem.
            Audio.Volume.Weld(Config.GetBindable <double>(OsuConfig.VolumeUniversal));
            Audio.VolumeSample.Weld(Config.GetBindable <double>(OsuConfig.VolumeEffect));
            Audio.VolumeTrack.Weld(Config.GetBindable <double>(OsuConfig.VolumeMusic));

            PlayMode = Config.GetBindable <PlayMode>(OsuConfig.PlayMode);

            Add(new Drawable[] {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes  = Axes.Both,
                    ActivateRequested = delegate { volume.Show(); }
                },
                mainContent = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                },
                volume = new VolumeControl
                {
                    VolumeGlobal = Audio.Volume,
                    VolumeSample = Audio.VolumeSample,
                    VolumeTrack  = Audio.VolumeTrack
                },
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                new GlobalHotkeys //exists because UserInputManager is at a level below us.
                {
                    Handler = globalHotkeyPressed
                }
            });

            (modeStack = new Intro
            {
                Beatmap = Beatmap
            }).Preload(game, d =>
            {
                mainContent.Add(d);

                modeStack.ModePushed += modeAdded;
                modeStack.Exited     += modeRemoved;
                modeStack.DisplayAsRoot();
            });

            //overlay elements
            (chat = new ChatConsole(API)
            {
                Depth = 0
            }).Preload(game, overlayContent.Add);
            (musicController = new MusicController()).Preload(game, overlayContent.Add);
            (Options = new OptionsOverlay {
                Depth = 1
            }).Preload(game, overlayContent.Add);
            (Toolbar = new Toolbar
            {
                Depth = 2,
                OnHome = delegate { mainMenu?.MakeCurrent(); },
                OnSettings = Options.ToggleVisibility,
                OnPlayModeChange = delegate(PlayMode m) { PlayMode.Value = m; },
                OnMusicController = musicController.ToggleVisibility
            }).Preload(game, t =>
            {
                PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
                PlayMode.TriggerChange();
                overlayContent.Add(Toolbar);
            });

            Cursor.Alpha = 0;
        }
Exemplo n.º 29
0
    void makeimwindow(string name,ChatConsole cs,bool group,UUID target)
    {
        Gtk.Image image=new Gtk.Image(MainClass.GetResource("closebox.png"));
        image.HeightRequest=16;
        image.WidthRequest=16;

        Gtk.Image icon;

        if(group)
            icon=new Gtk.Image(MainClass.GetResource("icon_group.png"));
        else
            icon=new Gtk.Image(MainClass.GetResource("icn_voice-groupfocus.png"));

        image.SetSizeRequest(16,16);
        Gtk.Label lable=new Gtk.Label(name);
        Gtk.Button button=new Gtk.Button(image);
        button.SetSizeRequest(16,16);
        Gtk.HBox box=new Gtk.HBox();
        box.PackStart(icon);
        box.PackStart(lable);
        box.PackStart(button);
        box.SetChildPacking(image,false,false,0,PackType.Start);

        box.ShowAll();
        notebook.InsertPage(cs,box,-1);
        notebook.ShowAll();
        cs.tabLabel=lable;
        AsyncNameUpdate ud;

        if(target!=UUID.Zero)
        {
            if(group)
                ud=new AsyncNameUpdate(target,true);
            else
                ud=new AsyncNameUpdate(target,false);

            ud.onNameCallBack += delegate(string namex,object [] values){cs.tabLabel.Text=namex;};
            ud.go();
        }

        button.Clicked += new EventHandler(cs.clickclosed);
        this.notebook.SwitchPage += new SwitchPageHandler(cs.onSwitchPage);
    }
Exemplo n.º 30
0
    public void startIM(UUID target)
    {
        if(!active_ims.Contains(target))
        {

            Gtk.Application.Invoke(delegate {
                ChatConsole imc=new ChatConsole(target);
                makeimwindow("Waiting...",imc,false,target);

                active_ims.Add(target);
            });
        }
    }
Exemplo n.º 31
0
 public override void Dispose()
 {
     Objects = null;
     Chat = null;
     base.Dispose();
 }
Exemplo n.º 32
0
        public override void Run(string args, List <string> splitArgs)
        {
            int id  = -1;
            int amt = 1;

            if (splitArgs.Count == 0)
            {
                return;
            }

            EntityType entityType = EntityType.Npc;//Just so intellisense would stfu since it returns if it fails anyways

            try
            {
                entityType = EntityTypeFromStr(splitArgs[0]);
            }
            catch
            {
                ChatConsole.Error("'{0}' is not a valid entity type (Npc, Item, Wall, Tile, Mount, or Projectile)");
                return;
            }

            if (!int.TryParse(splitArgs[1], out id))
            {
                string[] splitID = splitArgs[1].Split('.');



                if (splitID.Length < 2)
                {
                    ChatConsole.Error("If you specify the entity by name rather than by ID you must precede it by either a mod's internal name or 'Vanilla' followed by a dot ('.'). e.x. \"Vanilla.TheDestroyer\" or \"MyTotallyTubularMod.RadicalNpcDude\"");
                    return;
                }

                string modName         = splitID[0];
                string entityName      = splitID[1];
                bool   isVanillaEntity = modName.ToLower() == "vanilla";

                try
                {
                    switch (entityType)
                    {
                    case EntityType.Item:       id = ItemDef.Defs[splitID[1], isVanillaEntity ? null : splitID[0]].Type; break;

                    case EntityType.Npc:        id = NpcDef.Defs[splitID[1], isVanillaEntity ? null : splitID[0]].Type; break;

                    case EntityType.Projectile: id = ProjectileDef.Defs[splitID[1], isVanillaEntity ? null : splitID[0]].Type; break;

                    case EntityType.Tile:       id = TileDef.Defs[splitID[1], isVanillaEntity ? null : splitID[0]].Type; break;

                    case EntityType.Wall:       id = WallDef.Defs[splitID[1], isVanillaEntity ? null : splitID[0]].Type; break;
                    }
                }
                catch (InvalidOperationException)
                {
                    ChatConsole.Error(isVanillaEntity ? "Could not find vanilla {2} with internal name '{0}'." : "Could not find {2} with internal name '{0}' in the data of mod '{1}'.", splitID[1], splitID[0], entityType);
                    return;
                }
            }

            if (splitArgs.Count > 2)
            {
                if (!int.TryParse(splitArgs[2], out amt))
                {
                    ChatConsole.Error("'{0}' is not a number.", splitArgs[2]);
                    return;
                }
            }

            for (int i = 0; i < amt; i++)
            {
                int   x         = (int)Main.MouseWorld.X;
                int   y         = (int)Main.MouseWorld.Y;
                Point tileCoord = Main.MouseWorld.ToTileCoordinates();

                switch (entityType)
                {
                case EntityType.Item:       Item.NewItem(x, y, 32, 32, id, amt); return;     //All in one stack; no need to repeat spawn command.

                case EntityType.Npc:        NPC.NewNPC(x, y, id); break;

                case EntityType.Projectile: Projectile.NewProjectile(x, y, 2 * (float)Main.rand.NextDouble() - 1, 2 * (float)Main.rand.NextDouble() - 1, id, ProjectileDef.Defs[id].Damage, ProjectileDef.Defs[id].Knockback, Main.myPlayer); break;

                case EntityType.Tile:       WorldGen.PlaceTile(tileCoord.X, tileCoord.Y, id, false, false, Main.myPlayer); return; //You can only place one tile in a location.

                case EntityType.Wall:       WorldGen.PlaceWall(tileCoord.X, tileCoord.Y, id, false); return;                       //You can only place one wall in a location.
                }
            }
        }
Exemplo n.º 33
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            Add(new Drawable[] {
                new VolumeControlReceptor
                {
                    RelativeSizeAxes = Axes.Both,
                    ActionRequested  = delegate(InputState state) { volume.Adjust(state); }
                },
                mainContent = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                },
                volume         = new VolumeControl(),
                overlayContent = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                new GlobalHotkeys //exists because UserInputManager is at a level below us.
                {
                    Handler = globalHotkeyPressed
                }
            });

            (modeStack = new Intro()).Preload(this, d =>
            {
                mainContent.Add(d);

                modeStack.ModePushed += modeAdded;
                modeStack.Exited     += modeRemoved;
                modeStack.DisplayAsRoot();
            });

            //overlay elements
            (chat = new ChatConsole(API)
            {
                Depth = 0
            }).Preload(this, overlayContent.Add);
            (Options = new OptionsOverlay {
                Depth = 1
            }).Preload(this, overlayContent.Add);
            (musicController = new MusicController()
            {
                Depth = 3
            }).Preload(this, overlayContent.Add);
            (Toolbar = new Toolbar
            {
                Depth = 2,
                OnHome = delegate { mainMenu?.MakeCurrent(); },
                OnSettings = Options.ToggleVisibility,
                OnPlayModeChange = delegate(PlayMode m) { PlayMode.Value = m; },
                OnMusicController = musicController.ToggleVisibility
            }).Preload(this, t =>
            {
                PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
                PlayMode.TriggerChange();
                overlayContent.Add(Toolbar);
            });

            Cursor.Alpha = 0;
        }
Exemplo n.º 34
0
 public override void Dispose()
 {
     Chat = null;
     base.Dispose();
 }
Exemplo n.º 35
0
 public override void Dispose()
 {
     Instance.State.OnWalkStateCanged -= new StateManager.WalkStateCanged(State_OnWalkStateCanged);
     Objects = null;
     Chat = null;
     base.Dispose();
 }