![]() |
|
#1
|
|||
|
|||
![]()
You can give the path the the dll relative to the path with the launcher.exe, for example:
Code:
//$reference parts/il2dce/IL2DCE.Mission.dll |
#2
|
|||
|
|||
![]() Quote:
Your example naming seems to be identical to the namespaces you use, maybe i should wrap my custom class in a namespace according to the dlls folder (yes i havent used a namespace). or some kind of default compiler option for my net4.0 runtime is different and messing things up. |
#3
|
|||
|
|||
![]()
This is really strange.
http://code.google.com/p/il2dce/sour....GameServer.cs I can load assemblies with the following script. However I get a exception because Core is not marked as serializable. Do you have a similar problem and have to mark classes you use within a mission as serializable? |
#4
|
|||
|
|||
![]()
I guess its good to access "imported objects with //$reference" after everything is loaded and initialized. From what i see things differ a bit before and after the initialization of a mission. For example one strange thing i noticed is: The first version of this mission had "Assembly.GetExecutingAssembly().Location" command inside OnBattleStarted Method, which returned a path with "1cSoftClub" in it but the same command returns the launcher.exe path when used as a variable's default value at the top.
I never had an issue with serializability when both deriving the Mission class from a custom class and when using/accessing another class. if you are not saving your class or another object inside with its current state intentionally, probably something in the process of packing your dll and/or loading it requires serialization, to save or to send it somewhere in memory as a stream, etc. try using alternative approaches when importing/accessing your classes. Hope this helps. Btw i'm just curious, is there a specific purpose of importing gamePlay.dll via //$reference, which is as far as i know, identical to this Code:
using maddox.game; using maddox.game.play; ![]() |
#5
|
|||
|
|||
![]()
I had to import gamePlay.dll because I cast a IGamePlay object to GameDef. GameDef is defined within this assembly and is otherwhise not know. In fact this gives a lot of new possibilities because GameDef has some useful methods (like the Chat event).
With "using" you only don't need to write always the namespace before you access something of it but it doesn't load the assembly. |
#6
|
|||
|
|||
![]()
wow this is great, will give it a try, thanks a lot!
![]() |
#7
|
|||
|
|||
![]() Code:
// IL2DCE: A dynamic campaign engine for IL-2 Sturmovik: Cliffs of Dover // Copyright (C) 2011 Stefan Rothdach // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //$reference parts/IL2DCE/IL2DCE.dll //$reference parts/core/gamePlay.dll //$debug using System; using maddox.game; using maddox.game.world; public class Mission : AMission { public override void OnBattleStarted() { base.OnBattleStarted(); maddox.game.GameDef game = GamePlay as maddox.game.GameDef; game.EventChat += new GameDef.Chat(Game_EventChat); } void Game_EventChat(IPlayer from, string msg) { if (msg.Contains("!hello")) { GamePlay.gpLogServer(new Player[] { from }, "Hello World!", null); } } } ![]() |
#8
|
|||
|
|||
![]()
no matter what i tried i couldnt manage to create a reference to gamedev object, all castings i tried returned null in Init method, probably would get serialization error instead in OnBattleStarted method, since GameDev is abstract and its constructor which the game uses needs an IGameInterface, there must be a way to keep it as a reference with the right type. i guess "as" operator tries to serialize gameplay for conversion. idk if gameplay can be casted like this directly or indirectly. which makes me think devs may have done this to restrict these parts from users. it would be better to ask for a proper way for this, maybe they can include new methods/properties for us in the future to interact more extensively.
|
![]() |
|
|