示例#1
0
 /// <summary>
 ///
 /// </summary>
 protected RuntimeDeviceBase(IApplicationSettingsService applicationSettingsService,
                             IRuntimeModeDriversService runtimeModeDriversService,
                             ApplicationConnectionService.ApplicationConnectionService applicationConnectionService,
                             IDeviceTimerInterrogationService timerInterrigationService, IDefectState defectState,
                             IDeviceDataCache deviceDataCache, IAnalogData analogData, IResistorFactory resistorFactory,
                             ICustomItemsFactory customItemsFactory, ConnectionLogger connectionLogger)
 {
     _applicationSettingsService   = applicationSettingsService;
     _runtimeModeDriversService    = runtimeModeDriversService;
     _applicationConnectionService = applicationConnectionService;
     _timerInterrigationService    = timerInterrigationService;
     _resistorFactory    = resistorFactory;
     _customItemsFactory = customItemsFactory;
     _connectionLogger   = connectionLogger;
     this._starterToLighttingModeDictionary = new Dictionary <int, LightingModeEnum>();
     this._starterToLighttingModeDictionary.Add(1, LightingModeEnum.UNDEFINED);
     this._starterToLighttingModeDictionary.Add(2, LightingModeEnum.UNDEFINED);
     this._starterToLighttingModeDictionary.Add(3, LightingModeEnum.UNDEFINED);
     _timerInterrigationService.SetDeviceForInterrogation(this);
     _timerInterrigationService.InterrogationCycleComplete += () =>
     {
         DeviceValuesUpdated?.Invoke();
     };
     DefectState       = defectState;
     DeviceDataCache   = deviceDataCache;
     AnalogData        = analogData;
     ResistorsOnDevice = new List <IResistor>();
     StartersOnDevice  = new List <IStarter>();
 }
示例#2
0
    void InitializeConnectionLogger()
    {
        Instantiate(connection_logger_prefab, new Vector3(5.35f, -9.15f, 0), Quaternion.identity);
        connection_logger = GameObject.FindObjectOfType <ConnectionLogger>();
        if (PhotonNetwork.connected && PhotonNetwork.isMasterClient)
        {
            UnInvertObject(connection_logger.gameObject);
        }
        connection_logger.SetTextMesh(connection_logger.GetComponent <TextMesh>());

        if (PhotonNetwork.connected)
        {
            connection_logger.DisplayHosting();

            if (PhotonNetwork.isMasterClient && PhotonNetwork.playerList.Length > 1)
            {
                PhotonPlayer[] other_players = PhotonNetwork.otherPlayers;
                string         player_lists_concatenation = "";
                foreach (PhotonPlayer o_p in other_players)
                {
                    player_lists_concatenation += o_p.name + ", ";
                }

                player_lists_concatenation = player_lists_concatenation.Substring(0, player_lists_concatenation.Length - 2);
                connection_logger.DisplayGuestConnected(player_lists_concatenation);
            }
            else if (!PhotonNetwork.isMasterClient && PhotonNetwork.playerList.Length > 1)
            {
                connection_logger.DisplayGuesting(PhotonNetwork.masterClient.name);
            }
        }
    }
示例#3
0
        [ServerEvent(Event.PlayerConnected)]// Connection Event. When did the error start happening? its now 0.3.7.0 from 0.3.6

        public void ConnectionDisplayLogin(Client client)
        {
            // Update logs with connection informati
            ConnectionLogger L = new ConnectionLogger();
            PlayerLogin      M = new PlayerLogin();

            string msg = $"Someone using the name{client.Name}  has connected to the server.";

            M.PlayerLoginWindow(client);
        }
示例#4
0
        [ServerEvent(Event.PlayerDisconnected), ]//Disconnect Event.

        public void ConnectionDisplayDisconnect(Client client, DisconnectionType type, string reason)
        {   //When player disconnectes launch the following functions
            string playerName  = client.Name;
            int    playermoney = Getplayerstat(client, "MONEY");
            int    playermats  = Getplayerstat(client, "MATERIALS");

            db.Update($"UPDATE `players` SET `pmoney` = '{playermoney}', `pmaterials` = '{playermats}' WHERE `name` = '{playerName}'; ");
            //Update logs with disconnection information.
            string           msg = $"Someone using the name {client.Name} has disconnected from the server.";
            ConnectionLogger L   = new ConnectionLogger();

            L.LogMessageToFile(msg);
        }
        public async Task <bool> Connect(Uri peerUri)
        {
            try
            {
                ConnectionLogger?.Invoke($"Establishing connection to {peerUri.OriginalString}");

                await WebSocketClient.Connect(peerUri, ConnectionLogger);

                return(await Task.FromResult(true));
            }
            catch (WebSocketException e)
            {
                Debug.WriteLine($"Caught web socket exception {e.Message}");
                ConnectionLogger?.Invoke(e.Message);
                return(await Task.FromResult(false));
            }
        }
示例#6
0
 public Runo3RuntimeDevice(IApplicationSettingsService applicationSettingsService,
                           IRuntimeModeDriversService runtimeModeDriversService, IRuno3StarterFactory runo3StarterFactory,
                           ApplicationConnectionService.ApplicationConnectionService applicationConnectionService,
                           IDeviceTimerInterrogationService timerInterrigationService, IDefectState defectState, IDeviceDataCache deviceDataCache, IAnalogData analogData, IResistorFactory resistorFactory, ICustomItemsFactory customItemsFactory, ConnectionLogger connectionLogger) : base(
         applicationSettingsService, runtimeModeDriversService,
         applicationConnectionService, timerInterrigationService, defectState, deviceDataCache, analogData, resistorFactory, customItemsFactory, connectionLogger)
 {
     _runo3StarterFactory = runo3StarterFactory;
 }
示例#7
0
 public Picon2RuntimeDevice(IApplicationSettingsService applicationSettingsService,
                            IRuntimeModeDriversService runtimeModeDriversService, Picon2StarterFactory picon2StarterFactory,
                            ApplicationConnectionService.ApplicationConnectionService applicationConnectionService,
                            IDeviceTimerInterrogationService timerInterrigationService, IDefectState defectState, IDeviceDataCache deviceDataCache, IAnalogData analogData, IResistorFactory resistorFactory, ICustomItemsFactory customItemsFactory, ConnectionLogger connectionLogger) : base(
         applicationSettingsService, runtimeModeDriversService,
         applicationConnectionService, timerInterrigationService, defectState, deviceDataCache, analogData, resistorFactory, customItemsFactory, connectionLogger)
 {
     _picon2StarterFactory = picon2StarterFactory;
     Picon2ModuleInfo      = new Picon2ModuleInfo();
 }