示例#1
0
        public void Load(BinaryReader r, BlenderFile file)
        {
            IsParsable = (
                Count > 0 && Size > 0 && Size == Count * file.SDNA.Structures[SDNAIndex].Size &&
                !Code.Equals("DNA1", StringComparison.Ordinal) &&
                !Code.Equals("ENDB", StringComparison.Ordinal)
                );

            OriginalData = r.ReadBytes(Size);             // original data is needed to resolve multidimensional pointers later

            if (!IsParsable)
            {
                GameDebugger.Log(LogLevel.VerboseDebug, "LOADING BYTES ONLY {0} size={1} addr=0x{2:X16} SDNA={3} count={4}", Code, Size, OldMemoryAddress, SDNAIndex, Count);
                return;
            }

            r.BaseStream.Position = DataPosition;
            ulong addr = OldMemoryAddress;

            Data = new BlenderFileObject[Count];
            GameDebugger.Log(LogLevel.VerboseDebug, "LOADING STRUCT {0} size={1} addr=0x{2:X16} SDNA={3} count={4}", Code, Size, OldMemoryAddress, SDNAIndex, Count);
            for (int i = 0; i < Count; i++)
            {
                Data[i] = new BlenderFileObject(r, file, addr, SDNAIndex);
                addr   += (ulong)file.SDNA.Structures[SDNAIndex].Size;
            }
        }
        private void RefreshMonitorData()
        {
            lock (SyncRoot) {
                GameDebugger.EngineLog(LogLevel.Debug, "Searching monitors attached to display device '{0}'.", m_DeviceInfo.DeviceName);

                AllMonitors = new List <MonitorInfoEx>();
                unsafe { IGE.Platform.Win32.API.Externals.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, EnumMonitorsCallback, IntPtr.Zero); }

                m_Monitors = new List <MonitorInfoEx>();
                foreach (MonitorInfoEx mi in AllMonitors)
                {
                    if (mi.DeviceName.Equals(m_DeviceInfo.DeviceName))
                    {
                        GameDebugger.EngineLog(LogLevel.Debug, "Added monitor Resolution={0}; WorkingSize={1}; Flags={2}", mi.Monitor, mi.Work, mi.Flags);
                        m_Monitors.Add(mi);
                    }
                }
                if (m_Monitors.Count == 0)
                {
                    GameDebugger.EngineLog(LogLevel.Error, "Could not find any monitors attached to display device '{0}'. Listing all monitors for debugging purposes:", m_DeviceInfo.DeviceName);
                    foreach (MonitorInfoEx mi in AllMonitors)
                    {
                        GameDebugger.EngineLog(LogLevel.Error, "Monitor '{0}': Resolution={1}; WorkingSize={2}; Flags={3}", mi.DeviceName, mi.Monitor, mi.Work, mi.Flags);
                    }
                }
            }
        }
示例#3
0
        private static Script CompileScript(string code, QuestSystemScriptEnvironment environment, string type, ulong id)
        {
            GameDebugger.Log(LogLevel.Debug, "Compiling script for {0} '0x{1:X16}'", type, id);
            Script script = new Script(code);

            script.Environment = environment;
            ErrorInfo[] errors    = script.Compile();
            bool        badScript = false;

            if (errors.Length > 0)
            {
                foreach (ErrorInfo error in errors)
                {
                    if (error.Level >= ErrorLevel.Error)
                    {
                        badScript = true;
                    }
                    GameDebugger.Log(error.LogLevel, "{0} '0x{1:X16}' script: [{2}] {3}", type, id, error.Level, error.Message);
                }
            }

            if (badScript)
            {
                GameDebugger.Log(LogLevel.Debug, "Script compilation failed");
                return(null);
            }
            GameDebugger.Log(LogLevel.Debug, "Script compiled successfully");
            return(script);
        }
示例#4
0
 protected void Log(LogLevel level, string format, params object[] par)
 {
     if (GameDebugger.MinNetLogLevel <= level)
     {
         GameDebugger.NetLog(level, String.Format("[{0}/{1:8X}] {2}", ConnectionIndex, Thread.CurrentThread.GetHashCode(), String.Format(format, par)));
     }
 }
        public static List <DisplayDevice> GetAvailableDevices(bool list_all)
        {
            int index = 0;
            List <DisplayDevice>    list = new List <DisplayDevice>();
            DisplayDeviceInfoStruct dd   = new DisplayDeviceInfoStruct();

            while (IGE.Platform.Win32.API.Externals.EnumDisplayDevices(null, index++, dd, 1))
            {
                if (!list_all)
                {
                    if ((dd.StateFlags & DisplayDeviceStateFlags.Active) != DisplayDeviceStateFlags.Active)
                    {
                        continue;
                    }
                    if ((dd.StateFlags & DisplayDeviceStateFlags.MirroringDriver) == DisplayDeviceStateFlags.MirroringDriver)
                    {
                        continue;
                    }
                }
                GameDebugger.EngineLog(LogLevel.Debug, "Found display device: Id={0}; Key={1}; Name={2}; String={3}; Flags={4}", dd.DeviceID, dd.DeviceKey, dd.DeviceName, dd.DeviceString, dd.StateFlags);
                list.Add(new DisplayDevice(dd));
                dd = new DisplayDeviceInfoStruct();
            }
            return(list);
        }
示例#6
0
        protected void Activate(BaseQuestObject obj)
        {
            QuestObjectState state = GetState(obj);

            if (state.Locked || state.Active != QuestObjectState.ActivationState.Inactive)
            {
                return;
            }
            state.Active = QuestObjectState.ActivationState.Active;
            GameDebugger.Log(LogLevel.Debug, "QS: Activated {0} '0x{1:X16}'", obj.GetType().Name, obj.Id);
            if (obj is QuestCondition)
            {
                // conditions must be actively checked every quest system tick
                GameDebugger.Log(LogLevel.Debug, "QS: Adding {0} '0x{1:X16}' to the list of actively checked objects", obj.GetType().Name, obj.Id);
                m_ActivelyChecked.Add(obj.Id, obj);
            }
            else if (obj is QuestObjective)
            {
                // quest objectives must be actively checked every quest system tick, but only when there is at least one output that has a script assigned
                bool hasScriptsOnOutputs = false;
                foreach (QuestPin pin in obj.Outputs)
                {
                    if (pin.Script != null)
                    {
                        hasScriptsOnOutputs = true;
                        break;
                    }
                }
                if (hasScriptsOnOutputs)
                {
                    GameDebugger.Log(LogLevel.Debug, "QS: Adding {0} '0x{1:X16}' to the list of actively checked objects due to existing scripts on one or more outputs", obj.GetType().Name, obj.Id);
                    m_ActivelyChecked.Add(obj.Id, obj);
                }
                GameDebugger.Log(LogLevel.Debug, "QS: event: OnQuestObjectiveActivated");
                if (OnQuestObjectiveActivated != null)
                {
                    OnQuestObjectiveActivated.Invoke(new QuestObjectiveActivatedEventArgs((QuestObjective)obj));
                }
            }
            else if (obj is Quest)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: event: OnQuestActivated");
                if (OnQuestActivated != null)
                {
                    OnQuestActivated.Invoke(new QuestActivatedEventArgs((Quest)obj));
                }
            }
            else
            {
                if (obj is QuestInstruction)
                {
                    ExecuteScript((QuestInstruction)obj);
                }
                foreach (QuestPin pin in obj.Outputs)
                {
                    Activate(pin);
                }
            }
            // when quest gets activated it does nothing since objectives actually get activated by quest's active input pins
        }
示例#7
0
        protected virtual void Dispose(bool manual)
        {
            if (!m_Disposed)
            {
                if (manual)
                {
                    if (Textures != null)
                    {
                        foreach (Texture tex in Textures)
                        {
                            if (tex != null && !tex.Disposed)
                            {
                                tex.Dispose();
                            }
                        }
                    }
                    if (Shader != null && !Shader.Disposed)
                    {
                        Shader.Dispose();
                    }
                }
                else
                {
                    GameDebugger.Log(LogLevel.Warning, "One of materials was not properly disposed");
                }

                m_Disposed = true;
            }
        }
示例#8
0
        protected void Deactivate(QuestPin pin)
        {
            QuestObjectState state = GetState(pin);

            if (state.Locked || state.Active == QuestObjectState.ActivationState.Inactive)
            {
                return;
            }
            state.Active = QuestObjectState.ActivationState.Inactive;
            GameDebugger.Log(LogLevel.Debug, "QS: {0} '0x{1:X16}' deactivated", pin.GetType().Name, pin.Id);

            if (pin.Type == GraphPin.PinType.Input)
            {
                if (m_ActivelyChecked.ContainsKey(pin.Id))
                {
                    GameDebugger.Log(LogLevel.Debug, "QS: Removing {0} '0x{1:X16}' from the list of actively checked objects", pin.GetType().Name, pin.Id);
                    m_ActivelyChecked.Remove(pin.Id);
                }
            }

            foreach (QuestConnection connection in pin.Connections)
            {
                if (connection.Source != pin)
                {
                    continue;
                }
                Deactivate(connection);
            }

            if (pin.Type == GraphPin.PinType.Input)
            {
                Deactivate((BaseQuestObject)pin.Node);
            }
        }
示例#9
0
 protected virtual void Dispose(bool manual)
 {
     if (m_Id != 0)
     {
         if (manual)
         {
             if (m_Id != 0)
             {
                 GL.DeleteObject(m_Id);
             }
             if (m_VertexShader != null)
             {
                 m_VertexShader.Dispose();
             }
             if (m_FragmentShader != null)
             {
                 m_FragmentShader.Dispose();
             }
             m_VertexShader   = null;
             m_FragmentShader = null;
             m_Id             = 0;
         }
         else
         {
             GameDebugger.Log(LogLevel.Warning, "One of shaders was not properly disposed");
         }
     }
 }
示例#10
0
        protected void CheckInputsOnActivation(BaseQuestObject obj)
        {
            // all objects except quests get activated when all their input pins are active
            bool allActive = true;

            GameDebugger.Log(LogLevel.Debug, "QS: Checking inputs of {0} '0x{1:X16}'", obj.GetType().Name, obj.Id);
            foreach (QuestPin pin in obj.Inputs)
            {
                QuestObjectState state = GetState(pin);
                if (state.Active != QuestObjectState.ActivationState.Active)
                {
                    allActive = false;
                    break;
                }
            }
            if (allActive)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: SUCCESS");
                Activate((BaseQuestObject)obj);
            }
            else
            {
                GameDebugger.Log(LogLevel.Debug, "QS: FAIL");
            }
        }
示例#11
0
 public void QuestComplete(QuestPin pin)
 {
     if (pin.Node is Quest)
     {
         GameDebugger.Log(LogLevel.Debug, "QS: Manually completing quest '{0}' by activating pin '0x{1:X16}'", ((Quest)pin.Node).Name, pin.Id);
         Activate(pin);
     }
 }
示例#12
0
 public void QuestActivate(QuestPin pin)
 {
     if (pin.Node is Quest)
     {
         GameDebugger.Log(LogLevel.Debug, "QS: Manually activating quest input pin '0x{0:X16}'", pin.Id);
         Activate(pin);
     }
 }
示例#13
0
 public virtual byte[] ReadToEnd()
 {
     if (m_Client == null)
     {
         throw new ObjectDisposedException("IgeNetStream");
     }
     GameDebugger.NetLog(LogLevel.Debug, "IgeNetStream ReadToEnd()");
     return(m_Client.RecvToEnd());
 }
示例#14
0
        private static bool ImportArticyPins(ArticyFlowObject source, BaseQuestObject target, bool compileInputScripts, bool compileOutputScripts, Dictionary <ulong, QuestPin> pinIndex)
        {
            FlowObjectPin articyPin;
            QuestPin      pin;
            bool          badScripts = false;

            foreach (GraphPin graphPin in source.Inputs)
            {
                articyPin = (FlowObjectPin)graphPin;
                pin       = new QuestPin(articyPin.Type, articyPin.Id);
                if (compileInputScripts && !string.IsNullOrWhiteSpace(articyPin.Script))
                {
                    if ((pin.Script = CompileScript(articyPin.Script, Quests.InputPinScriptEnvironment, "input pin", articyPin.Id)) == null)
                    {
                        badScripts = true;
                    }
                }
                if (string.IsNullOrEmpty(target.Key))
                {
                    GameDebugger.Log(LogLevel.Debug, "Adding intput pin to '0x{0:X16}'", target.Id);
                }
                else
                {
                    GameDebugger.Log(LogLevel.Debug, "Adding intput pin to '{0}'", target.Key);
                }
                pinIndex.Add(articyPin.Id, pin);
                target.AddInput(pin);
            }

            foreach (GraphPin graphPin in source.Outputs)
            {
                articyPin = (FlowObjectPin)graphPin;
                pin       = new QuestPin(articyPin.Type, articyPin.Id);
                if (compileOutputScripts && !string.IsNullOrWhiteSpace(articyPin.Script))
                {
                    QuestSystemScriptEnvironment env;
                    env = (target is QuestObjective) ? (QuestSystemScriptEnvironment)Quests.OutputPinScriptEnvironment : (QuestSystemScriptEnvironment)Quests.InstructionScriptEnvironment;
                    if ((pin.Script = CompileScript(articyPin.Script, env, "output pin", articyPin.Id)) == null)
                    {
                        badScripts = true;
                    }
                }
                if (string.IsNullOrEmpty(target.Key))
                {
                    GameDebugger.Log(LogLevel.Debug, "Adding output pin to '0x{0:X16}'", target.Id);
                }
                else
                {
                    GameDebugger.Log(LogLevel.Debug, "Adding output pin to '{0}'", target.Key);
                }
                pinIndex.Add(articyPin.Id, pin);
                target.AddOutput(pin);
            }

            return(badScripts);
        }
示例#15
0
 public virtual void DisconnectAll()
 {
     RawClient[] clients = GetClients();
     GameDebugger.NetLog(LogLevel.Debug, "{0}/DisconnectAll: {1} clients", GetType().Name, clients.Length);
     foreach (RawClient client in clients)
     {
         GameDebugger.NetLog(LogLevel.Debug, "{0}/DisconnectAll: {1}", GetType().Name, client);
         client.Disconnect();
     }
 }
示例#16
0
    private void Start()
    {
        var debug = new GameDebugger();

        debug.Init();
        debug.AddText("In Game Debugger");
        debug.AddText(() => "Counter : " + counter);
        debug.AddButton("Add", () => { counter++; Debug.Log("Counter " + counter); });
        debug.AddConsole();
    }
示例#17
0
        protected void Deactivate(BaseQuestObject obj)
        {
            QuestObjectState state = GetState(obj);

            if (state.Locked || state.Active == QuestObjectState.ActivationState.Inactive)
            {
                return;
            }
            state.Active = QuestObjectState.ActivationState.Inactive;
            GameDebugger.Log(LogLevel.Debug, "QS: {0} '0x{1:X16}' deactivated", obj.GetType().Name, obj.Id);

            if (m_ActivelyChecked.ContainsKey(obj.Id))
            {
                GameDebugger.Log(LogLevel.Debug, "QS: Removing {0} '0x{1:X16}' from the list of actively checked objects", obj.GetType().Name, obj.Id);
                m_ActivelyChecked.Remove(obj.Id);
            }

            if (obj is Quest)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: event: OnQuestDeactivated");
                if (OnQuestDeactivated != null)
                {
                    OnQuestDeactivated.Invoke(new QuestDeactivatedEventArgs((Quest)obj));
                }
                if (state.Completion != QuestObjectState.CompletionState.Incomplete)
                {
                    state.Completion = QuestObjectState.CompletionState.Incomplete;
                    // NOTE: This most probably will never happen since quests are locked right after getting complete,
                    // but might need to invoke OnQuestIncomplete event in case this happens after all.
                }
            }
            else if (obj is QuestObjective)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: event: OnQuestObjectiveDeactivated");
                if (OnQuestObjectiveDeactivated != null)
                {
                    OnQuestObjectiveDeactivated.Invoke(new QuestObjectiveDeactivatedEventArgs((QuestObjective)obj));
                }
                if (state.Completion != QuestObjectState.CompletionState.Incomplete)
                {
                    state.Completion = QuestObjectState.CompletionState.Incomplete;
                    GameDebugger.Log(LogLevel.Debug, "QS: event: OnQuestObjectiveIncomplete");
                    if (OnQuestObjectiveIncomplete != null)
                    {
                        OnQuestObjectiveIncomplete.Invoke(new QuestObjectiveIncompleteEventArgs((QuestObjective)obj));
                    }
                }
            }

            foreach (QuestPin pin in obj.Outputs)
            {
                Deactivate(pin);
            }
        }
示例#18
0
        protected void Activate(QuestConnection connection)
        {
            QuestObjectState state = GetState(connection);

            if (state.Locked || state.Active != QuestObjectState.ActivationState.Inactive)
            {
                return;
            }
            state.Active = QuestObjectState.ActivationState.Active;
            GameDebugger.Log(LogLevel.Debug, "QS: Activated connection '0x{0:X16}'", connection.Id);
            Activate((QuestPin)connection.Target);
        }
示例#19
0
        protected void Deactivate(QuestConnection connection)
        {
            QuestObjectState state = GetState(connection);

            if (state.Locked || state.Active == QuestObjectState.ActivationState.Inactive)
            {
                return;
            }
            state.Active = QuestObjectState.ActivationState.Inactive;
            GameDebugger.Log(LogLevel.Debug, "QS: {0} '0x{1:X16}' deactivated", connection.GetType().Name, connection.Id);

            Deactivate((QuestPin)connection.Target);
        }
示例#20
0
 public override bool Load(String fileName)
 {
     try {
         using (StructuredTextFile xml = GameFile.LoadFile <StructuredTextFile>(fileName)) {
             return(Load(fileName, xml.Root));
         }
     }
     catch (Exception ex) {
         GameDebugger.Log(LogLevel.Error, "Exception occured while trying to load the font from '{0}':", fileName);
         GameDebugger.Log(LogLevel.Error, ex);
         return(false);
     }
 }
示例#21
0
        public void ExecuteScript(IScriptableQuestSystemObject obj)
        {
            Script script = obj.Script;

            GameDebugger.Log(LogLevel.Debug, "QS: Executing script of {0} '0x{1:X16}'", obj.GetType().Name, obj.Id);
            if (script == null)
            {
                GameDebugger.Log(LogLevel.Debug, "QS: no script to execute");
                return;
            }
            script.Run(this);
            GameDebugger.Log(LogLevel.Debug, "QS: done");
        }
示例#22
0
        protected void Lock(QuestConnection connection, bool propagate)
        {
            QuestObjectState state = GetState(connection);

            if (state.Locked)
            {
                return;
            }
            state.Locked = true;
            GameDebugger.Log(LogLevel.Debug, "QS: {0} '0x{1:X16}' locked", connection.GetType().Name, connection.Id);
            if (propagate)
            {
                Lock((QuestPin)connection.Source);
            }
        }
 internal DinamicLibrary(string dll_name)
 {
     lock (SyncRoot) {
         m_LibraryName = dll_name;
         if (!LibraryMap.TryGetValue(m_LibraryName, out dll_name))
         {
             dll_name = m_LibraryName.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) ? m_LibraryName : String.Concat(m_LibraryName, ".dll");
         }
         m_hDLL = IGE.Platform.Win32.API.Externals.LoadLibrary(dll_name);
         // GameDebugger.Log("Loading DLL: {0} 0x{1:x}", m_LibraryName, m_hDLL);
         if (m_hDLL == IntPtr.Zero)
         {
             GameDebugger.EngineLog(LogLevel.Error, "Failed loading library '{0}'. Error code: {1}", dll_name, Marshal.GetLastWin32Error());
         }
     }
 }
示例#24
0
 static UI()
 {
     Defaults = new UIDefaults();
     GameDebugger.EngineLog(LogLevel.Debug, "Trying to load UI defaults from '{0}'", GameConfig.UIDefaultsFile.ToPath());
     try {
         Defaults.Load(GameConfig.UIDefaultsFile.ToPath());
         GameDebugger.EngineLog(LogLevel.Debug, "UI defaults loaded successfully");
     }
     catch (FileNotFoundException) {
         GameDebugger.EngineLog(LogLevel.Debug, "UI defaults file is not found.");
         GameDebugger.EngineLog(LogLevel.Debug, "Using hardcoded UI defaults.");
     }
     catch (Exception ex) {
         GameDebugger.EngineLog(LogLevel.Debug, "Error while trying to load UI defaults: {0}", ex.ToString());
         GameDebugger.EngineLog(LogLevel.Debug, "Using hardcoded UI defaults.");
     }
 }
示例#25
0
        public void QuestObjectiveIncomplete(QuestObjective objective)
        {
            QuestObjectState state = GetState(objective);

            if (state.Locked || state.Completion == QuestObjectState.CompletionState.Incomplete)
            {
                return;
            }
            state.Completion = QuestObjectState.CompletionState.Incomplete;

            GameDebugger.Log(LogLevel.Debug, "QS: event: OnQuestObjectiveIncomplete");
            if (OnQuestObjectiveIncomplete != null)
            {
                OnQuestObjectiveIncomplete.Invoke(new QuestObjectiveIncompleteEventArgs(objective));
            }

            Deactivate((QuestPin)objective.Outputs[state.CompletionOutput]);
        }
示例#26
0
 protected virtual void Dispose(bool manual)
 {
     if (!Disposed)
     {
         if (manual)
         {
             if (m_Id != 0)
             {
                 GL.DeleteObject(m_Id);
             }
             m_Id = 0;
         }
         else
         {
             GameDebugger.Log(LogLevel.Warning, "One of shader objects ({0}) was not properly disposed", m_ObjectType.ToString());
         }
     }
 }
        /// <summary>
        /// Creates an instance of a display device
        /// </summary>
        /// <param name="index">Index of the display device with base on 1. If the display with selected index does not exist, this object will be created for the primary display device (same as calling static method DisplayDevice.GetPrimary()).</param>
        public DisplayDevice(string id)
        {
            GameDebugger.EngineLog(LogLevel.Debug, "Searching for display device '{0}'", id);
            m_DeviceInfo = new DisplayDeviceInfoStruct();
            m_Exists     = false;
            List <DisplayDevice> devices = DisplayDevice.GetAvailableDevices();

            if (id != null)
            {
                foreach (DisplayDevice dev in devices)
                {
                    if (dev.Id.Equals(id))
                    {
                        m_DeviceInfo = dev.m_DeviceInfo;
                        m_Exists     = true;
                        break;
                    }
                }
            }
            if (!m_Exists)
            {
                GameDebugger.EngineLog(LogLevel.Notice, "Did not find a requested display device. Using primary display device instead.");
                foreach (DisplayDevice dev in devices)
                {
                    if (dev.Primary)
                    {
                        GameDebugger.EngineLog(LogLevel.Debug, "Primary display device found.");
                        m_DeviceInfo = dev.m_DeviceInfo;
                        m_Exists     = true;
                        break;
                    }
                }
            }
            if (m_Exists)
            {
                DisplayMode.ResolutionChangeEvent += RefreshMonitorData;
                RefreshMonitorData();
            }
            else
            {
                GameDebugger.EngineLog(LogLevel.Error, "Primary display device not found.");
            }
        }
示例#28
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            GameDebugger.ActivateDeactivateDebugSetting(GameDebugger.DebugSetting.DRAW_COLLISION_BOXES);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            GameDebugger.ActivateDeactivateDebugSetting(GameDebugger.DebugSetting.DRAW_HITBOXES);
        }

        for (int i = ListDebugLogMessagesToDisplay.Count - 1; i >= 0; --i)
        {
            if (ListDebugLogMessagesToDisplay[i].TimeRemainingBeforeClear < 0)
            {
                RemoveLogMessage(ListDebugLogMessagesToDisplay[i]);
            }
        }
    }
示例#29
0
        public bool AssignSocket(Socket socket, Server server)
        {
            lock (SyncRoot) {
                if (socket == m_Socket)
                {
                    return(false);
                }
                if (m_Socket != null)
                {
                    DisconnectInternal(null);
                }
                m_Socket = socket;
                if (m_Socket == null)
                {
                    return(false);
                }
                m_Socket.NoDelay        = true;
                m_Socket.ReceiveTimeout = 1000;
                m_Socket.SendTimeout    = 1000;
                CreateThreads(server);

                m_LocalEndpoint  = (IPEndPoint)socket.LocalEndPoint;
                m_RemoteEndpoint = (IPEndPoint)socket.RemoteEndPoint;

                Log(LogLevel.Info, "Connected: Local={0}; Remote={1}", m_LocalEndpoint.ToString(), m_RemoteEndpoint.ToString());
            }

            try {
                OnConnect(server);
                if (ConnectEvent != null)
                {
                    ConnectEvent.Invoke(this, new ConnectEventArgs(server));
                }
                PostInit(server);
            }
            catch (Exception ex) {
                GameDebugger.NetLog(LogLevel.Error, "Exception while initializing socket: {0}", ex);
                OnInitException(server, ex);
            }

            return(true);
        }
示例#30
0
 public ResourceContext(DeviceContext dc)
 {
     m_DC  = dc;
     m_hRC = IntPtr.Zero;
     if (m_DC == null || m_DC.Disposed)
     {
         GameDebugger.EngineLog(LogLevel.Error, "Device context cannot be used to create an OpenGL resource context");
         return;
     }
     m_hRC = WGL.CreateContext(m_DC.Handle);
     if (m_hRC != IntPtr.Zero)
     {
         m_DC.BeforeReleaseEvent += OnBeforeDeviceContextRelease;
     }
     else
     {
         // GameDebugger.EngineLog(LogLevel.Error, "Trying to create a resouce context returned a null handle. Error was: {0}", GL.GetError());
         GameDebugger.EngineLog(LogLevel.Error, "Trying to create a resouce context returned a null handle. Error was: {0}", IGE.Platform.Win32.API.Externals.GetLastError());
     }
 }