View Single Post
  #15  
Old 05-23-2012, 02:58 PM
podvoxx podvoxx is offline
Approved Member
 
Join Date: Feb 2010
Posts: 190
Default

Quote:
Originally Posted by FG28_Kodiak View Post
@podvoxx

btw. ive created a translation system, also:
Big thanks, Kodiak! Now I use Small_bee loc. system
http://www.sukhoi.ru/forum/showthrea...=1#post1765804
Maybe this system will be use in repka comander - http://www.sukhoi.ru/forum/showthread.php?t=75862

About my DLL, it not work
My script:
Code:
//$reference "parts\core\SMP\SMPlocalization.dll"
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using locfiledll;


public class Mission : AMission
{


    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        localization.ToChatbar(player, "Welcome {0}", player);


    }
}
Path to dll-file: parts\core\SMP\SMPlocalization.dll
My dll-file:
Code:
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using part;

namespace locfiledll
{
    
        public static class localization 
        {
            static readonly IGamePlay GamePlay = Strategy.THIS.GamePlay;


            public static void ToChatbar(string msg, params object[] args)
            {
                GamePlay.gpLogServer(null, msg, args);
            }


            public static void ToChatbar(Player player, string msg, params object[] args)
            {
                if (player != null)
                    GamePlay.gpLogServer(new[] { player }, msg, args);
            }


            public static void ToChatbar(int army, string msg, params object[] args)
            {
                var consignees = new List<Player>();

                if (GamePlay.gpPlayer() != null)
                    consignees.Add(GamePlay.gpPlayer());
                if (GamePlay.gpRemotePlayers() != null)
                    consignees.AddRange(GamePlay.gpRemotePlayers());

                if (army == -1)
                    GamePlay.gpLogServer(null, msg, args);
                else if (consignees.Exists(item => item.Army() == army))
                    GamePlay.gpLogServer(consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
            }


            public static void ToScreen(string msg, params object[] args)
            {
                GamePlay.gpHUDLogCenter(null, msg, args);
            }


            public static void ToScreen(Player player, string msg, params object[] args)
            {
                if (player != null)
                    GamePlay.gpHUDLogCenter(new[] { player }, msg, args);
            }     

        }
}
After calling OnPlaceEnter method I have this error:
Code:
[18:42:32]	=================================================
[18:42:32]	System.IO.FileNotFoundException: Could not load file or assembly 'SMPlocalization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Не удается найти указанный файл.
[18:42:32]	File name: 'SMPlocalization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
[18:42:32]	
[18:42:32]	Server stack trace: 
[18:42:32]	   at Mission.OnPlaceEnter(Player player, AiActor actor, Int32 placeIndex)
[18:42:32]	   at maddox.game.ABattle.OnPlaceEnter(Player player, AiActor actor, Int32 placeIndex)
[18:42:32]	   at maddox.game.ABattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[18:42:32]	   at maddox.game.world.Strategy.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[18:42:32]	   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[18:42:32]	   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[18:42:32]	
[18:42:32]	Exception rethrown at [0]: 
[18:42:32]	   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[18:42:32]	   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[18:42:32]	   at maddox.game.IBattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[18:42:32]	   at maddox.game.GameDef.eventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[18:42:32]	   at QS9s5gXYpyXIbWqUeH5.NEqYCeXQeE9aADb49yZ.LNESqn0gobx(GameEventId , Object , Object , Int32 )
[18:42:32]	
[18:42:32]	WRN: Assembly binding logging is turned OFF.
[18:42:32]	To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
[18:42:32]	Note: There is some performance penalty associated with assembly bind failure logging.
[18:42:32]	To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
[18:42:32]	
[18:42:32]	=================================================

Last edited by podvoxx; 05-23-2012 at 03:09 PM.
Reply With Quote