Inheritance: VMSerializable
示例#1
0
        private bool DisableRead = false; //don't have read permission

        #endregion Fields

        #region Constructors

        public VMEODSignsPlugin(VMEODServer server)
            : base(server)
        {
            //we have data. load from global server.
            server.vm.GlobalLink.LoadPluginPersist(server.vm, server.Object.PersistID, server.PluginID, (byte[] data) =>
            {
                lock (this)
                {
                    if (data == null)
                    {
                        Data = new VMEODSignsData();
                        Data.Flags = (ushort)(VMEODSignPermissionFlags.RoomieWrite | VMEODSignPermissionFlags.RoomieRead
                        | VMEODSignPermissionFlags.FriendRead | VMEODSignPermissionFlags.VisitorRead);
                    }
                    else Data = new VMEODSignsData(data);
                }
            });

            BinaryHandlers["set_message"] = B_SetMessage;
            PlaintextHandlers["close"] = P_Close;
        }
示例#2
0
 public void B_Show(string evt, byte[] data)
 {
     Data = new VMEODSignsData(data);
     Controller.ShowEODMode(new EODLiveModeOpt
     {
         Buttons = 0,
         Expandable = false,
         Height = EODHeight.Tall,
         Length = (OwnerMode)?EODLength.Medium:EODLength.Full,
         Timer = EODTimer.None,
         Tips = EODTextTips.None
     });
     SetMode(Mode);
     OwnerWriteTextBox.CurrentText = Data.Text;
     WriteTextBox.CurrentText = Data.Text;
     ReadTextBox.CurrentText = Data.Text;
     UpdatePermissions();
 }
示例#3
0
        public void B_SetMessage(string evt, byte[] data, VMEODClient client)
        {
            lock (this)
            {
                VMEODSignsData newData;
                try
                {
                    newData = new VMEODSignsData(data);
                }
                catch (Exception) { return; }

                if (Mode == VMEODSignsMode.Read) return; //cannot change anything
                else if (Mode == VMEODSignsMode.Write) newData.Flags = Data.Flags; //cannot change permissions

                if (newData.Text.Length > 0) newData.Text = newData.Text.Substring(0, Math.Min(MaxLength, newData.Text.Length));
                Data = newData;

                Server.vm.GlobalLink.SavePluginPersist(Server.vm, Server.Object.PersistID, Server.PluginID, newData.Save());

                foreach (var cli in Server.Clients)
                    cli.SendOBJEvent(new VMEODEvent((short)VMEODSignsEvent.TurnOnWritingSign, (short)((Data.Text.Length > 0) ? 1 : 0)));
            }
        }