示例#1
0
文件: Api.cs 项目: YGOProTH/ygosharp
        private static UInt32 OnCardReader(UInt32 code, Card.CardData *pData)
        {
            Card card = CardsManager.GetCard((int)code);

            if (card != null)
            {
                *pData = card.Data;
            }
            return(code);
        }
示例#2
0
文件: Api.cs 项目: YGOProTH/ygosharp
        public static void Init(string rootPath = ".", string scriptDirectory = "script", string databaseFile = "cards.cdb")
        {
            _rootPath        = rootPath;
            _scriptDirectory = scriptDirectory;

            CardsManager.Init(Path.Combine(Path.GetFullPath(rootPath), databaseFile));

            Duel.Duels = new Dictionary <IntPtr, Duel>();

            _buffer = Marshal.AllocHGlobal(65536);

            _cardCallback    = OnCardReader;
            _scriptCallback  = OnScriptReader;
            _messageCallback = OnMessageHandler;

            set_card_reader(_cardCallback);
            set_script_reader(_scriptCallback);
            set_message_handler(_messageCallback);
        }
示例#3
0
 public static Card Get(int id)
 {
     return(CardsManager.GetCard(id));
 }