Example #1
0
        public MapSettingsDialog(IGamePlugin plugin, PropertyTracker <BasicSection> basicSettingsTracker, PropertyTracker <BriefingSection> briefingSettingsTracker,
                                 IDictionary <House, PropertyTracker <House> > houseSettingsTrackers)
        {
            InitializeComponent();

            this.plugin = plugin;
            this.basicSettingsTracker    = basicSettingsTracker;
            this.briefingSettingsTracker = briefingSettingsTracker;
            this.houseSettingsTrackers   = houseSettingsTrackers;

            settingsTreeView.BeginUpdate();
            settingsTreeView.Nodes.Clear();
            settingsTreeView.Nodes.Add("BASIC", "Basic");
            settingsTreeView.Nodes.Add("BRIEFING", "Briefing");

            playersNode = settingsTreeView.Nodes.Add("Players");
            foreach (var player in plugin.Map.Houses)
            {
                var playerNode = playersNode.Nodes.Add(player.Type.Name, player.Type.Name);
                playerNode.Checked = player.Enabled;
            }
            playersNode.Expand();

            settingsTreeView.EndUpdate();
            settingsTreeView.SelectedNode = settingsTreeView.Nodes[0];
        }
Example #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="when">When to process the event</param>
 /// <param name="who">Which object should process the event</param>
 /// <param name="what">Type of event</param>
 public Event(int ID, Int64 when, IGamePlugin who, EventType what, int posX, int posY)
 {
     this.EventID = ID;
     this.when = when;
     this.who = who;
     this.what = what;
 }
Example #3
0
 protected bool loadPlugin(byte[] rawDll, string fileName)
 {
     try
     {
         var assembly = Assembly.Load(rawDll);
         var types    = assembly.GetTypes();
         foreach (var type in types)
         {
             if (type.GetInterfaces().Length > 0)
             {
                 IGamePlugin instance = assembly.CreateInstance(type.FullName) as IGamePlugin;
                 if (instance != null)
                 {
                     mPluginList.Add(instance.getPluginName(), instance);
                     logInfo("game plugin " + instance.getPluginName() + " load success!");
                 }
             }
         }
     }
     catch (Exception e)
     {
         logInfo("load game plugin failed! file name : " + fileName + ", info : " + e.Message);
         return(false);
     }
     return(true);
 }
Example #4
0
        public void PrepareMovement(Int64 goTime, double phase, IGamePlugin who, EventType ev, int speed)
        {
            IMovableElement gamePlugin = who as IMovableElement;

            if (gamePlugin != null)
            {
                // Change X, Y coordinates

                if (((MovableEssentials)gamePlugin).ImmediatelyOccupyNewField == false)
                {
                    gamePlugin.InitializeMove((MovementDirection)ev);
                }
                else
                {
                    gamePlugin.FinishMove((MovementDirection)ev);
                }
                
                gamePlugin.MovementStartTime = goTime;
                gamePlugin.MovementStartTimePhase = phase;
                gamePlugin.MovementEndTime = goTime + speed;
                gamePlugin.LastMovementEvent = ev;

                // Forced event!
                MakePlan("PrepMovWentXXX", gamePlugin.MovementEndTime, who, (EventType)((int)ev + 10), true); // goXXX -> wentXXX
            }
        }
Example #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ID">Identifier of the event - for debugging purposes</param>
 /// <param name="when">When to process the event</param>
 /// <param name="who">Which object should process the event</param>
 /// <param name="what">Type of event</param>
 public Event(int ID, Int64 when, IGamePlugin who, EventType what)
 {
     this.EventID = ID;
     this.when = when;
     this.who = who;
     this.what = what;
     // useful for two player game
 }
Example #6
0
 public static void RemovePlugin(IGamePlugin plug)
 {
     try
     {
         _gameplugs.Remove(plug);
     }
     catch (Exception ex)
     {
         Environment.ReportError(ex, AccessManager.AccessKey);
     }
 }
Example #7
0
        /// <summary>
        /// Method integrates plugin to the structures of GameRepository according to its properties (movable, fixed, ..)
        /// </summary>
        /// <param name="gamePlugin"></param>
        private bool integratePlugin(IGamePlugin gamePlugin)
        {
            // Plugin can receive keyboard input
            IControllableByUserInput controllableByUser = gamePlugin as IControllableByUserInput;

            if (controllableByUser != null)
            {
                controllableByUserObjects.Add(controllableByUser);

                if (controllableByUser.StepsCount != -1)
                {
                    stepsCountGameObject = controllableByUser;
                }
            }

            bool isElement = false;

            IFixedElement fixedElement = gamePlugin as IFixedElement;

            if (fixedElement != null)
            {
                isElement = true;
                fixedElements[fixedElement.PosX - 1, fixedElement.PosY - 1] = gamePlugin;
            }

            // Tiles
            IFixedTile fixedTile = gamePlugin as IFixedTile;

            if (fixedTile != null)
            {
                isElement = true;
                fixedTiles[fixedTile.PosX - 1, fixedTile.PosY - 1] = gamePlugin;
            }

            // Objects
            IMovableElement movableElement = gamePlugin as IMovableElement;

            if (movableElement != null)
            {
                isElement = true;
                movableElements.Add(movableElement);
            }

            if (isElement)
            {
                gameObjects.Add(gamePlugin);
                gamePlugin.ID = gameObjects.Count - 1;
            }

            return isElement;
        }
        public BasicSettings(IGamePlugin plugin, dynamic basicSection)
        {
            InitializeComponent();

            playerComboBox.DataSource = plugin.Map.Houses.Select(h => h.Type.Name).ToArray();
            baseComboBox.DataSource   = plugin.Map.Houses.Select(h => h.Type.Name).ToArray();
            introComboBox.DataSource  = plugin.Map.MovieTypes.ToArray();
            briefComboBox.DataSource  = plugin.Map.MovieTypes.ToArray();
            actionComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
            winComboBox.DataSource    = plugin.Map.MovieTypes.ToArray();
            win2ComboBox.DataSource   = plugin.Map.MovieTypes.ToArray();
            win3ComboBox.DataSource   = plugin.Map.MovieTypes.ToArray();
            win4ComboBox.DataSource   = plugin.Map.MovieTypes.ToArray();
            loseComboBox.DataSource   = plugin.Map.MovieTypes.ToArray();

            carryOverMoneyNud.DataBindings.Add("Value", basicSection, "CarryOverMoney");
            nameTxt.DataBindings.Add("Text", basicSection, "Name");
            percentNud.DataBindings.Add("Value", basicSection, "Percent");
            playerComboBox.DataBindings.Add("SelectedItem", basicSection, "Player");
            authorTxt.DataBindings.Add("Text", basicSection, "Author");
            isSinglePlayerCheckBox.DataBindings.Add("Checked", basicSection, "SoloMission");
            introComboBox.DataBindings.Add("SelectedItem", basicSection, "Intro");
            briefComboBox.DataBindings.Add("SelectedItem", basicSection, "Brief");
            actionComboBox.DataBindings.Add("SelectedItem", basicSection, "Action");
            winComboBox.DataBindings.Add("SelectedItem", basicSection, "Win");
            loseComboBox.DataBindings.Add("SelectedItem", basicSection, "Lose");

            switch (plugin.GameType)
            {
            case GameType.TiberianDawn:
                buidLevelNud.DataBindings.Add("Value", basicSection, "BuildLevel");
                baseLabel.Visible = baseComboBox.Visible = false;
                win2Label.Visible = win2ComboBox.Visible = false;
                win3Label.Visible = win3ComboBox.Visible = false;
                win4Label.Visible = win4ComboBox.Visible = false;
                break;

            case GameType.RedAlert:
                buidLevelNud.Visible = buildLevelLabel.Visible = false;
                baseComboBox.DataBindings.Add("SelectedItem", basicSection, "BasePlayer");
                win2ComboBox.DataBindings.Add("SelectedItem", basicSection, "Win2");
                win3ComboBox.DataBindings.Add("SelectedItem", basicSection, "Win3");
                win4ComboBox.DataBindings.Add("SelectedItem", basicSection, "Win4");
                break;
            }

            introComboBox.Enabled = briefComboBox.Enabled = actionComboBox.Enabled = loseComboBox.Enabled = isSinglePlayerCheckBox.Checked;
            winComboBox.Enabled   = win2ComboBox.Enabled = win3ComboBox.Enabled = win4ComboBox.Enabled = isSinglePlayerCheckBox.Checked;
        }
        public TeamTypesDialog(IGamePlugin plugin, int maxTeams)
        {
            this.plugin   = plugin;
            this.maxTeams = maxTeams;
            technoTypes   = plugin.Map.InfantryTypes.Cast <ITechnoType>().Concat(plugin.Map.UnitTypes.Cast <ITechnoType>());

            InitializeComponent();

            switch (plugin.GameType)
            {
            case GameType.TiberianDawn:
                triggerLabel.Visible  = triggerComboBox.Visible = false;
                waypointLabel.Visible = waypointComboBox.Visible = false;
                break;

            case GameType.RedAlert:
                learningCheckBox.Visible   = false;
                mercernaryCheckBox.Visible = false;
                break;
            }

            teamTypes = new List <TeamType>(plugin.Map.TeamTypes.Select(t => t.Clone()));

            teamTypesListView.BeginUpdate();
            {
                foreach (var teamType in this.teamTypes)
                {
                    var item = new ListViewItem(teamType.Name)
                    {
                        Tag = teamType
                    };
                    teamTypesListView.Items.Add(item).ToolTipText = teamType.Name;
                }
            }
            teamTypesListView.EndUpdate();

            houseComboBox.DataSource    = plugin.Map.Houses.Select(t => new TypeItem <HouseType>(t.Type.Name, t.Type)).ToArray();
            waypointComboBox.DataSource = "(none)".Yield().Concat(plugin.Map.Waypoints.Select(w => w.Name)).ToArray();
            triggerComboBox.DataSource  = Trigger.None.Yield().Concat(plugin.Map.Triggers.Select(t => t.Name)).ToArray();

            teamsTypeColumn.DisplayMember = "Name";
            teamsTypeColumn.ValueMember   = "Type";
            teamsTypeColumn.DataSource    = technoTypes.Select(t => new TypeItem <ITechnoType>(t.Name, t)).ToArray();

            missionsMissionColumn.DataSource = plugin.Map.TeamMissionTypes;

            teamTypeTableLayoutPanel.Visible = false;
        }
Example #10
0
        public PlayerSettings(IGamePlugin plugin, PropertyTracker <House> houseSettingsTracker)
        {
            this.houseSettingsTracker = houseSettingsTracker;
            house = houseSettingsTracker;

            InitializeComponent();

            edgeComboBox.Items.Clear();
            edgeComboBox.Items.AddRange(new string[] { "North", "South", "West", "East" });

            creditsNud.DataBindings.Add("Value", houseSettingsTracker, "Credits");
            maxBuildingsNud.DataBindings.Add("Value", houseSettingsTracker, "MaxBuilding");
            maxUnitsNud.DataBindings.Add("Value", houseSettingsTracker, "MaxUnit");
            edgeComboBox.DataBindings.Add("SelectedItem", houseSettingsTracker, "Edge");

            switch (plugin.GameType)
            {
            case GameType.TiberianDawn:
                maxInfantryNud.Visible        = maxInfantryLbl.Visible = false;
                maxVesselsNud.Visible         = maxVesselsLbl.Visible = false;
                techLevelNud.Visible          = techLevelLbl.Visible = false;
                iqNud.Visible                 = iqLbl.Visible = false;
                playerControlCheckBox.Visible = playerControlLbl.Visible = false;
                break;

            case GameType.RedAlert:
                maxInfantryNud.DataBindings.Add("Value", houseSettingsTracker, "MaxInfantry");
                maxVesselsNud.DataBindings.Add("Value", houseSettingsTracker, "MaxVessel");
                techLevelNud.DataBindings.Add("Value", houseSettingsTracker, "TechLevel");
                iqNud.DataBindings.Add("Value", houseSettingsTracker, "IQ");
                playerControlCheckBox.DataBindings.Add("Checked", houseSettingsTracker, "PlayerControl");
                break;
            }

            playersListBox.Items.Clear();
            playersListBox.Items.AddRange(plugin.Map.Houses.Select(h => h.Type.Name).ToArray());

            var selectedIndices = new List <int>();

            foreach (var id in house.Allies)
            {
                playersListBox.SetSelected(id, true);
            }

            playersListBox.SelectedIndexChanged += playersListBox_SelectedIndexChanged;
        }
        public SteamDialog(IGamePlugin plugin)
        {
            this.plugin = plugin;

            InitializeComponent();

            visibilityComboBox.DataSource = new []
            {
                new { Name = "Public", Value = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic },
                new { Name = "Friends Only", Value = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityFriendsOnly },
                new { Name = "Private", Value = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate }
            };

            statusUpdateTimer.Interval = 500;
            statusUpdateTimer.Tick    += StatusUpdateTimer_Tick;

            Disposed += (o, e) => { (previewTxt.Tag as Image)?.Dispose(); };
        }
Example #12
0
        public IGamePlugin Create(IPluginHost gameHost, string pluginName, Dictionary <string, string> config, out string errorMsg)
        {
            gameHost = new PluginHostWrapper(gameHost);
            gameHost.TryRegisterType(typeof(Locate), (byte)'Z', Locate.Serialize, Locate.Deserialize);

            IGamePlugin plugin = null;

            if (pluginName.Equals("JoinExtensionPlugin"))
            {
                plugin = new JoinExtensionPlugin();
            }

            if (plugin != null && plugin.SetupInstance(gameHost, config, out errorMsg))
            {
                return(plugin);
            }

            errorMsg = string.Empty;
            return(null);
        }
 private IGamePlugin ActivatePluginType(Type loadedType)
 {
     try
     {
         //"as IGamePlugin" will cast or return null if the type is not a IGamePlugin
         IGamePlugin pluginInstance = Activator.CreateInstance(loadedType) as IGamePlugin;
         return(pluginInstance);
     }
     catch (Exception e)
     {
         if (logging)
         {
             Debug.Log("UnityPluginSystem: Exception thrown while activating plugin " + loadedType.Name);
         }
         if (logging)
         {
             Debug.LogException(e);
         }
         return(null);
     }
 }
Example #14
0
 protected bool loadPlugin(byte[] rawDll)
 {
     try
     {
         var assembly = Assembly.Load(rawDll);
         var types    = assembly.GetTypes();
         foreach (var type in types)
         {
             if (type.GetInterfaces().Length > 0)
             {
                 IGamePlugin instance = assembly.CreateInstance(type.FullName) as IGamePlugin;
                 if (instance != null)
                 {
                     mPluginList.Add(instance.getPluginName(), instance);
                 }
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     TriggerCombo.DataSource = plugin.Map.Triggers.Select(t => t.Name).ToArray();
     Tool = new CellTriggersTool(mapPanel, activeLayers, toolStatusLabel, TriggerCombo, plugin, undoRedoList);
 }
Example #16
0
        public void Load(string appPath)
        {
            //
            // Textures
            //

            image = new System.Windows.Controls.Image();

            BitmapImage bi = new BitmapImage();
            bi.BeginInit();
            bi.UriSource = new Uri("pack://*****:*****@"\Plugins\Sounds\MonsterDidIt.wav"))
            {
                throw new PluginLoadFailedException("File `" + appPath + @"\Plugins\Sounds\MonsterDidIt.wav" + "` could not be found.");
            }
            else
            {
                sounds = new MediaElement();
                sounds.LoadedBehavior = MediaState.Manual; // TODO ADD TO THE INSTALLER
                sounds.Source = new Uri(appPath + @"\Plugins\Sounds\MonsterDidIt.wav");
                host.RegisterMediaElement(sounds);
            }

            foreach (IGamePlugin gp in host.AllPlugins)
            {
                if (gp.Name == "Sokoban")
                {
                    this.sokoban = gp;
                    break;
                }
            }

            if (this.sokoban == null)
            {
                throw new PluginLoadFailedException("There's no Sokoban plugin on game desk.");
            }

            obstructionLevel = - 1; // it's not an obstruction at all! Special value
            this.Speed = 7;
        }
Example #17
0
        public TriggersDialog(IGamePlugin plugin, int maxTriggers)
        {
            this.plugin      = plugin;
            this.maxTriggers = maxTriggers;

            InitializeComponent();

            switch (plugin.GameType)
            {
            case GameType.TiberianDawn:
                existenceLabel.Text  = "Loop";
                event1Label.Text     = "Event";
                action1Label.Text    = "Action";
                typeLabel.Visible    = typeComboBox.Visible = false;
                event2Label.Visible  = event2ComboBox.Visible = event2Flp.Visible = false;
                action2Label.Visible = action2ComboBox.Visible = action2Flp.Visible = false;
                break;

            case GameType.RedAlert:
                teamLabel.Visible = teamComboBox.Visible = false;
                break;
            }

            triggers = new List <Trigger>(plugin.Map.Triggers.Select(t => t.Clone()));

            triggersListView.BeginUpdate();
            {
                foreach (var trigger in triggers)
                {
                    var item = new ListViewItem(trigger.Name)
                    {
                        Tag = trigger
                    };
                    triggersListView.Items.Add(item).ToolTipText = trigger.Name;
                }
            }
            triggersListView.EndUpdate();

            string[] existenceNames = Enum.GetNames(typeof(TriggerPersistantType));
            switch (plugin.GameType)
            {
            case GameType.TiberianDawn:
                existenceNames = new string[] { "No", "And", "Or" };
                break;

            case GameType.RedAlert:
                existenceNames = new string[] { "Temporary", "Semi-Constant", "Constant" };
                break;
            }

            string[] typeNames = new string[]
            {
                "E => A1 [+ A2]",
                "E1 && E2 => A1 [+ A2]",
                "E1 || E2 => A1 [+ A2]",
                "E1 => A1; E2 => A2",
            };

            houseComboBox.DataSource     = "None".Yield().Concat(plugin.Map.Houses.Select(t => t.Type.Name)).ToArray();
            existenceComboBox.DataSource = Enum.GetValues(typeof(TriggerPersistantType)).Cast <int>()
                                           .Select(v => new { Name = existenceNames[v], Value = (TriggerPersistantType)v })
                                           .ToArray();
            typeComboBox.DataSource = Enum.GetValues(typeof(TriggerMultiStyleType)).Cast <int>()
                                      .Select(v => new { Name = typeNames[v], Value = (TriggerMultiStyleType)v })
                                      .ToArray();
            event1ComboBox.DataSource  = plugin.Map.EventTypes.Where(t => !string.IsNullOrEmpty(t)).ToArray();
            event2ComboBox.DataSource  = plugin.Map.EventTypes.Where(t => !string.IsNullOrEmpty(t)).ToArray();
            action1ComboBox.DataSource = plugin.Map.ActionTypes.Where(t => !string.IsNullOrEmpty(t)).ToArray();
            action2ComboBox.DataSource = plugin.Map.ActionTypes.Where(t => !string.IsNullOrEmpty(t)).ToArray();
            teamComboBox.DataSource    = "None".Yield().Concat(plugin.Map.TeamTypes.Select(t => t.Name)).ToArray();

            triggersTableLayoutPanel.Visible = false;
        }
        public CellTriggersTool(MapPanel mapPanel, MapLayerFlag layers, ToolStripStatusLabel statusLbl, ComboBox triggerCombo, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> url)
            : base(mapPanel, layers, statusLbl, plugin, url)
        {
            this.mapPanel.MouseDown            += MapPanel_MouseDown;
            this.mapPanel.MouseUp              += MapPanel_MouseUp;
            this.mapPanel.MouseMove            += MapPanel_MouseMove;
            (this.mapPanel as Control).KeyDown += WaypointsTool_KeyDown;
            (this.mapPanel as Control).KeyUp   += WaypointsTool_KeyUp;

            this.triggerCombo = triggerCombo;

            navigationWidget.MouseCellChanged += MouseoverWidget_MouseCellChanged;

            UpdateStatus();
        }
Example #19
0
File: SoTh.cs Project: MartyIX/SoTh
        public void Load(string appPath)
        {
            boxes = new List<IGamePlugin>();

            foreach (IGamePlugin gp in parent.AllPlugins)
            {
                if (gp.Name == "Box")
                {
                    boxes.Add(gp);
                }

                if (gp.Name == "Sokoban")
                {
                    sokoban = gp;
                }
            }

            aims = parent.GetFixedTiles();
        }
Example #20
0
 public PluginModel(IGamePlugin gamePlugin)
 {
     Id   = gamePlugin.GameId;
     Name = gamePlugin.GameName;
 }
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     ObjectTypeListBox.Types = plugin.Map.UnitTypes.Where(t => !t.IsFixedWing).OrderBy(t => t.Name);
     Tool = new UnitTool(mapPanel, activeLayers, toolStatusLabel, ObjectTypeListBox,
                         ObjectTypeMapPanel, ObjectProperties, plugin, undoRedoList);
 }
        public void LoadPlugins()
        {
            if (logging)
            {
                Debug.Log("UnityPluginSystem: Loading plugins...");
            }
            if (!Directory.Exists(Path.Combine(Environment.CurrentDirectory, "Plugins")))
            {
                Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "Plugins"));
            }

            //Load the assemblies from files
            List <Assembly> assemblies = new List <Assembly> ();

            string[] fileList = Directory.GetFiles(Path.Combine(Environment.CurrentDirectory, "Plugins"), "*", SearchOption.AllDirectories);
            foreach (string pluginPath in fileList)
            {
                if (Path.GetExtension(pluginPath).ToLower() == ".dll")
                {
                    try {
                        Assembly currentAssembly = Assembly.LoadFile(pluginPath);
                        assemblies.Add(currentAssembly);
                    } catch (Exception e) {
                        //Something went horribly wrong - do an LogExcep for them
                        if (logging)
                        {
                            Debug.Log("UnityPluginSystem: Exception thrown loading assembly " + pluginPath);
                        }
                        if (logging)
                        {
                            Debug.LogException(e);
                        }
                    }
                }
            }

            Type gameInterfaceType = typeof(IGamePlugin);

            foreach (Assembly loadedAssembly in assemblies)
            {
                Type[] loadedTypes = loadedAssembly.GetExportedTypes();
                foreach (Type loadedType in loadedTypes)
                {
                    Type[] typeInterfaces          = loadedType.GetInterfaces();
                    bool   containsPluginInterface = false;
                    foreach (Type typeInterface in typeInterfaces)
                    {
                        if (typeInterface == gameInterfaceType)
                        {
                            containsPluginInterface = true;
                        }
                    }
                    if (containsPluginInterface)
                    {
                        if (logging)
                        {
                            Debug.Log("UnityPluginSystem: Loading plugin: " + loadedType.FullName);
                        }

                        try
                        {
                            IGamePlugin pluginInstance = ActivatePluginType(loadedType);

                            if (pluginInstance != null)
                            {
                                if (logging)
                                {
                                    Debug.Log("UnityPluginSystem: Plugin loaded");
                                }
                                loadedPlugins.Add(pluginInstance);
                            }
                        }
                        catch (Exception excep)
                        {
                            if (logging)
                            {
                                Debug.Log("UnityPluginSystem: Exception thrown loading plugin " +
                                          loadedType.FullName + "(" + loadedType.Assembly.FullName + ")");
                            }
                            if (logging)
                            {
                                Debug.LogException(excep);
                            }
                        }
                    }
                    else
                    {
                        if (logging)
                        {
                            Debug.Log("UnityPluginSystem: Nothing to load in plugin: " + loadedType.FullName);
                        }
                    }
                }
            }
            if (logging)
            {
                Debug.Log("UnityPluginSystem: Done!");
            }
        }
Example #23
0
 public void MessageReceived(string messageType, object message, IGamePlugin p)
 {
 }
Example #24
0
 public bool IsIdenticalWith(Int64 when, IGamePlugin who, EventType what)
 {
     return (this.who == who && this.when == when && this.what == what);
 }
Example #25
0
 public override int ObstructionLevel(IGamePlugin asker)
 {
     if (asker.Name == "Monster")
     {
         return -1;
     }
     else
     {
         return 10;
     }
 }
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel,
                                 ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     GenericTypeListBox.Types = plugin.Map.SmudgeTypes.Where(t => (t.Flag & SmudgeTypeFlag.Bib) == SmudgeTypeFlag.None).OrderBy(t => t.Name);
     Tool = new SmudgeTool(mapPanel, activeLayers, toolStatusLabel, GenericTypeListBox, GenericTypeMapPanel, plugin, undoRedoList);
 }
Example #27
0
        public BriefingSettings(IGamePlugin plugin, dynamic briefingSection)
        {
            InitializeComponent();

            briefingTxt.DataBindings.Add("Text", briefingSection, "Briefing");
        }
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     TerrainTypeComboBox.Types = plugin.Map.TerrainTypes.Where(t => t.Theaters.Contains(plugin.Map.Theater)).OrderBy(t => t.Name);
     Tool = new TerrainTool(mapPanel, activeLayers, toolStatusLabel, TerrainTypeComboBox,
                            TerrainTypeMapPanel, TerrainProperties, plugin, undoRedoList);
 }
 public UnitToolDialog(IGamePlugin plugin) : base(plugin)
 {
     Text = "Units";
 }
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     ObjectTypeListBox.Types = plugin.Map.BuildingTypes
                               .Where(t => (t.Theaters == null) || t.Theaters.Contains(plugin.Map.Theater))
                               .OrderBy(t => t.IsFake)
                               .ThenBy(t => t.Name);
     Tool = new BuildingTool(mapPanel, activeLayers, toolStatusLabel, ObjectTypeListBox,
                             ObjectTypeMapPanel, ObjectProperties, plugin, undoRedoList);
 }
Example #31
0
 public CellTriggersTool(MapPanel mapPanel, MapLayerFlag layers, ToolStripStatusLabel statusLbl, ComboBox triggerCombo, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> url)
     : base(mapPanel, layers, statusLbl, plugin, url)
 {
     this.triggerCombo = triggerCombo;
 }
Example #32
0
        public void Load(string appPath)
        {
            boxes = new List<IGamePlugin>();

            foreach (IGamePlugin gp in parent.AllPlugins)
            {
                if (gp.Name == "Box")
                {
                    boxes.Add(gp);
                }

                if (gp.Name == "Sokoban")
                {
                    sokoban = gp;
                    ((IMovableElement)sokoban).ElementMoved += new GameObjectMovedDel(OrdinaryController_ElementMoved);
                }
            }

            aims = parent.GetFixedTiles();
        }
Example #33
0
 public virtual int ObstructionLevel(IGamePlugin asker)
 {
     return obstructionLevel;
 }
 public BuildingToolDialog(IGamePlugin plugin) : base(plugin)
 {
     Text = "Structures";
 }
Example #35
0
 public void MakePlan(string debug, long time, IGamePlugin iGamePlugin, EventType eventType)
 {
     MakePlan(debug, time, iGamePlugin, eventType, false);
 }
Example #36
0
 public abstract void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList);
Example #37
0
        public void MakePlan(string debug, long time, IGamePlugin iGamePlugin, EventType eventType, bool force)
        {
            if (EventTypeLib.IsEventOfType(eventType, EventCategory.goXXX))
            {
                if (movementEventsInBuffer == 0)
                {
                    timeWholeMovementEnds = time + this.speed;
                }
                else
                {
                    timeWholeMovementEnds += this.speed;
                }

                movementEventsInBuffer++;

                DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[MovableEssentials]", "[KeyBuf] Buffer is now: " + this.MovementEventsInBuffer.ToString());
            }

            host.MakePlan(debug, time, iGamePlugin, eventType, force);
        }
Example #38
0
 public CallEnv(IGamePlugin plugin, string gameName)
 {
     this.Plugin   = plugin;
     this.GameName = gameName;
 }
Example #39
0
 public void Initialize(IGamePlugin thisGamePlugin, bool immediatelyOccupyNewField)
 {
     this.immediatelyOccupyNewField = immediatelyOccupyNewField;
     this.thisGamePlugin = thisGamePlugin;
 }
Example #40
0
        private void OnLoadedRoundProperties(string gameVariant, string roundName, int fieldsX, int fieldsY)
        {
            this.RoundName = roundName; // we want to notify
            this.GameVariantName = gameVariant;
            this.fieldsX = fieldsX;
            this.fieldsY = fieldsY;

            fixedElements = new IGamePlugin[fieldsX, fieldsY];
            fixedTiles = new IGamePlugin[fieldsX, fieldsY];

            this.gameVariant = pluginService.RunVariant(gameVariant);
        }
Example #41
0
 public virtual void PrepareMovement(Int64 goTime, double phase, IGamePlugin who, EventType ev)
 {
     PrepareMovement(goTime, phase, who, ev, ((IMovableElement)who).Speed);
 }
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     GenericTypeListBox.Types = plugin.Map.OverlayTypes.Where(t => t.IsWall).OrderBy(t => t.Name);
     Tool = new WallsTool(mapPanel, activeLayers, toolStatusLabel,
                          GenericTypeListBox, GenericTypeMapPanel, plugin, undoRedoList);
 }
Example #43
0
 public InfantryToolDialog(IGamePlugin plugin) : base(plugin)
 {
     Text = "Infantry";
 }
Example #44
0
 public ObjectToolDialog(IGamePlugin plugin)
     : this()
 {
     objectProperties.Initialize(plugin, true);
 }
 public TerrainToolDialog(IGamePlugin plugin)
     : this()
 {
     terrainProperties.Initialize(plugin, true);
 }
Example #46
0
 public override void Initialize(MapPanel mapPanel, MapLayerFlag activeLayers, ToolStripStatusLabel toolStatusLabel, ToolTip mouseToolTip, IGamePlugin plugin, UndoRedoList <UndoRedoEventArgs> undoRedoList)
 {
     WaypointCombo.DataSource = plugin.Map.Waypoints.Select(w => w.Name).ToArray();
     Tool = new WaypointsTool(mapPanel, activeLayers, toolStatusLabel, WaypointCombo, plugin, undoRedoList);
 }
Example #47
0
        private void planHittingWall(string debugMessage, Int64 when, IGamePlugin who)
        {
            timeWholeMovementEnds -= this.speed;
            movementEventsInBuffer--;

            double diff = DateTime.Now.Subtract(lastPositionChange).TotalMilliseconds;

            if (diff > 400)
            {
                DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[MovableEssentials]", "planHittingWall = True; Diff = " + diff);
                MakePlan(debugMessage, when, who, EventType.hitToTheWall); // ev.who = this plugin
            }
            else
            {
                DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[MovableEssentials]", "planHittingWall = False; Diff = " + diff);
            }
        }