Пример #1
0
        internal void Subscribe(LocalLCDWriterComponent localLCDWriterComponent, ulong steamid)
        {
            VideoController controller;

            if (controllers.TryGetValue(steamid, out controller))
            {
                controller.Subscribe(localLCDWriterComponent, time.ElapsedTicks);
            }
        }
Пример #2
0
        internal void Unsubscribe(LocalLCDWriterComponent localLCDWriterComponent, ulong steamid)
        {
            VideoController controller;

            if (controllers.TryGetValue(steamid, out controller))
            {
                controller.UnSubscribe(localLCDWriterComponent);
            }
        }
Пример #3
0
 internal void UnSubscribe(LocalLCDWriterComponent localLCDWriterComponent)
 {
     MyLog.Default.WriteLineAndConsole($"VideoController UnSubscribe {localLCDWriterComponent.Entity.EntityId}");
     if (subscribers.Contains(localLCDWriterComponent))
     {
         return;
     }
     subscribers.Remove(localLCDWriterComponent);
 }
Пример #4
0
        private static void Setter(IMyTerminalBlock block, long arg2)
        {
            LocalLCDWriterComponent OutValue = null;


            OutValue = block.GameLogic.GetAs <LocalLCDWriterComponent>();
            if (OutValue == null)
            {
                return;
            }

            OutValue.SetSelectedRow(arg2);
        }
Пример #5
0
        private static long Getter(IMyTerminalBlock block)
        {
            LocalLCDWriterComponent OutValue = null;

            OutValue = block.GameLogic.GetAs <LocalLCDWriterComponent>();
            if (OutValue == null)
            {
                //MyAPIGateway.Utilities.ShowMessage("Outvalue", "Null");
                return(0);
            }

            return(OutValue.GetSelectedRow());
        }
Пример #6
0
 internal void Subscribe(LocalLCDWriterComponent localLCDWriterComponent, long elapsedTicks)
 {
     MyLog.Default.WriteLineAndConsole($"VideoController Subscribe {localLCDWriterComponent.Entity.EntityId}");
     if (subscribers.Count == 0)
     {
         SetRunTime(elapsedTicks);
     }
     if (subscribers.Contains(localLCDWriterComponent))
     {
         return;
     }
     subscribers.Add(localLCDWriterComponent);
 }
Пример #7
0
        internal void UpdateChannel(LocalLCDWriterComponent Comp, ulong arg2, ulong requester)
        {
            ChannelRegister value;

            if (!ChannelDictionary.TryGetValue(Comp.Entity.EntityId, out value))
            {
                value           = new ChannelRegister();
                value.component = Comp;
                ChannelDictionary.Add(Comp.Entity.EntityId, value);
            }
            value.channel = arg2;
            if (!offline)
            {
                SendUpdate(Comp.Entity.EntityId, arg2, requester);
            }
        }
Пример #8
0
        internal static bool TryRegisterAndGetChannel(LocalLCDWriterComponent Comp, out ulong channel)
        {
            ChannelRegister reg;
            var             ret = ChannelDictionary.TryGetValue(Comp.Entity.EntityId, out reg);

            if (ret)
            {
                channel = reg.channel;
                if (reg.component == null)
                {
                    reg.component = Comp;
                }
                return(true);
            }
            reg           = new ChannelRegister();
            reg.component = Comp;
            ChannelDictionary.Add(Comp.Entity.EntityId, reg);
            channel = 0;
            return(false);
        }
Пример #9
0
        internal void AddBuffer(VideoBuffer videoBuffer)
        {
            //MyLog.Default.WriteLine("AddBuffer");
            VideoController Component;

            lock (controllers)
            {
                if (controllers.TryGetValue(videoBuffer.steamid, out Component))
                {
                    Component = new VideoController(videoBuffer);
                }
                else
                {
                    Component = new VideoController(videoBuffer);
                    controllers.Add(videoBuffer.steamid, Component);
                    //MyLog.Default.WriteLine("AddLineItem Called from AddBuffer");
                    LocalLCDWriterComponent.AddLineItem(MyStringId.GetOrCompute(videoBuffer.steamid.ToString()), videoBuffer.steamid);
                }
                if (time.IsRunning)
                {
                    Component.SetRunTime(time.ElapsedTicks);
                }
            }
        }