Inheritance: PointEntity
Beispiel #1
0
        public static bool DestroyUi(BasePlayer player, string elem)
        {
            bool flag;

            if (player != null)
            {
                flag = player.net;
            }
            else
            {
                flag = false;
            }
            if (!flag)
            {
                return(false);
            }
            Interface.CallHook("OnDestroyUI", player, elem);
            CommunityEntity serverInstance = CommunityEntity.ServerInstance;
            SendInfo        sendInfo       = new SendInfo()
            {
                connection = player.net.connection
            };

            serverInstance.ClientRPCEx <string>(sendInfo, null, "DestroyUI", elem);
            return(true);
        }
    public override void InitShared()
    {
        if ( isServer ) ServerInstance = this;
        else ClientInstance = this;

        base.InitShared();
    }
Beispiel #3
0
        public static bool AddUi(BasePlayer player, string json)
        {
            bool flag;

            if (player != null)
            {
                flag = player.net;
            }
            else
            {
                flag = false;
            }
            if (!flag || Interface.CallHook("CanUseUI", player, json) != null)
            {
                return(false);
            }
            CommunityEntity serverInstance = CommunityEntity.ServerInstance;
            SendInfo        sendInfo       = new SendInfo()
            {
                connection = player.net.connection
            };

            serverInstance.ClientRPCEx <string>(sendInfo, null, "AddUI", json);
            return(true);
        }
    public override void DestroyShared()
    {
        base.DestroyShared();

        if ( isServer ) ServerInstance = null;
        else ClientInstance = null;
    }
Beispiel #5
0
    public static void test(ConsoleSystem.Arg args)
    {
        CommunityEntity serverInstance = CommunityEntity.ServerInstance;
        SendInfo        sendInfo1      = (SendInfo)null;

        sendInfo1.connection = (__Null)args.get_Connection();
        SendInfo sendInfo2 = sendInfo1;

        serverInstance.ClientRPCEx <string>(sendInfo2, (Connection)null, "AddUI", "[\t\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"name\": \"TestPanel7766\",\n\t\t\t\t\t\t\t\"parent\": \"Overlay\",\n\n\t\t\t\t\t\t\t\"components\":\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"UnityEngine.UI.RawImage\",\n\t\t\t\t\t\t\t\t\t\"imagetype\": \"Tiled\",\n\t\t\t\t\t\t\t\t\t\"color\": \"1.0 1.0 1.0 1.0\",\n\t\t\t\t\t\t\t\t\t\"url\": \"http://files.facepunch.com/garry/2015/June/03/2015-06-03_12-19-17.jpg\",\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"RectTransform\",\n\t\t\t\t\t\t\t\t\t\"anchormin\": \"0 0\",\n\t\t\t\t\t\t\t\t\t\"anchormax\": \"1 1\"\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"NeedsCursor\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"parent\": \"TestPanel7766\",\n\n\t\t\t\t\t\t\t\"components\":\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"UnityEngine.UI.Text\",\n\t\t\t\t\t\t\t\t\t\"text\":\"Do you want to press a button?\",\n\t\t\t\t\t\t\t\t\t\"fontSize\":32,\n\t\t\t\t\t\t\t\t\t\"align\": \"MiddleCenter\",\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"RectTransform\",\n\t\t\t\t\t\t\t\t\t\"anchormin\": \"0 0.5\",\n\t\t\t\t\t\t\t\t\t\"anchormax\": \"1 0.9\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"name\": \"Button88\",\n\t\t\t\t\t\t\t\"parent\": \"TestPanel7766\",\n\n\t\t\t\t\t\t\t\"components\":\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"UnityEngine.UI.Button\",\n\t\t\t\t\t\t\t\t\t\"close\":\"TestPanel7766\",\n\t\t\t\t\t\t\t\t\t\"command\":\"cui.endtest\",\n\t\t\t\t\t\t\t\t\t\"color\": \"0.9 0.8 0.3 0.8\",\n\t\t\t\t\t\t\t\t\t\"imagetype\": \"Tiled\"\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"RectTransform\",\n\t\t\t\t\t\t\t\t\t\"anchormin\": \"0.3 0.15\",\n\t\t\t\t\t\t\t\t\t\"anchormax\": \"0.7 0.2\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"parent\": \"Button88\",\n\n\t\t\t\t\t\t\t\"components\":\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"type\":\"UnityEngine.UI.Text\",\n\t\t\t\t\t\t\t\t\t\"text\":\"YES\",\n\t\t\t\t\t\t\t\t\t\"fontSize\":20,\n\t\t\t\t\t\t\t\t\t\"align\": \"MiddleCenter\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\n\t\t\t\t\t]\n\t\t\t\t\t");
    }
 public override void DestroyShared()
 {
     base.DestroyShared();
     if (base.isServer)
     {
         CommunityEntity.ServerInstance = null;
         return;
     }
     CommunityEntity.ClientInstance = null;
 }
Beispiel #7
0
    public static void endtest(ConsoleSystem.Arg args)
    {
        args.ReplyWith("Ending Test!");
        CommunityEntity serverInstance = CommunityEntity.ServerInstance;
        SendInfo        sendInfo1      = (SendInfo)null;

        sendInfo1.connection = (__Null)args.get_Connection();
        SendInfo sendInfo2 = sendInfo1;

        serverInstance.ClientRPCEx <string>(sendInfo2, (Connection)null, "DestroyUI", "TestPanel7766");
    }
Beispiel #8
0
    public static void endtest(ConsoleSystem.Arg args)
    {
        args.ReplyWith("Ending Test!");
        CommunityEntity serverInstance = CommunityEntity.ServerInstance;
        SendInfo        sendInfo       = new SendInfo()
        {
            connection = args.Connection
        };

        serverInstance.ClientRPCEx <string>(sendInfo, null, "DestroyUI", "TestPanel7766");
    }
 public override void DestroyShared()
 {
     base.DestroyShared();
     if (base.isServer)
     {
         ServerInstance = null;
     }
     else
     {
         ClientInstance = null;
     }
 }
Beispiel #10
0
 public override void InitShared()
 {
     if (base.isServer)
     {
         ServerInstance = this;
     }
     else
     {
         ClientInstance = this;
     }
     base.InitShared();
 }
 public override void InitShared()
 {
     if (!base.isServer)
     {
         CommunityEntity.ClientInstance = this;
     }
     else
     {
         CommunityEntity.ServerInstance = this;
     }
     base.InitShared();
 }
Beispiel #12
0
 public override void DestroyShared()
 {
     base.DestroyShared();
     if (this.isServer)
     {
         CommunityEntity.ServerInstance = (CommunityEntity)null;
     }
     else
     {
         CommunityEntity.ClientInstance = (CommunityEntity)null;
     }
 }
Beispiel #13
0
        CommunityDTO ToDTO(CommunityEntity community)
        {
            CommunityDTO dto = new CommunityDTO();

            dto.BulitYear      = community.BuiltYear;
            dto.CreateDateTime = community.CreateDateTIme;
            dto.Id             = community.Id;
            dto.Loaction       = community.Location;
            dto.Name           = community.Name;
            dto.RegionId       = community.RegionId;
            dto.Traffic        = community.Traffic;
            return(dto);
        }
Beispiel #14
0
        private CommunityDTO ToDTO(CommunityEntity com)
        {
            CommunityDTO dto = new CommunityDTO()
            {
                BuiltYear      = com.BuiltYear,
                CreateDateTime = com.CreateDateTime,
                Id             = com.Id,
                Location       = com.Location,
                Name           = com.Name,
                RegionId       = com.RegionId,
                Traffic        = com.Traffic
            };

            return(dto);
        }
        public CommunityDTO DTO(CommunityEntity entity)
        {
            CommunityDTO community = new CommunityDTO()
            {
                BuiltYear      = entity.BuiltYear,
                Id             = entity.Id,
                CreateDateTime = entity.CreateDateTime,
                Location       = entity.Location,
                Name           = entity.Name,
                RegionId       = entity.RegionId,
                Traffic        = entity.Traffic,
                RegionName     = entity.Region.Name
            };

            return(community);
        }
 public void AddCommunity(CommunityDTO community)
 {
     using (WarmHomeContext db = new WarmHomeContext())
     {
         BaseService <CommunityEntity> service = new BaseService <CommunityEntity>(db);
         CommunityEntity entity = new CommunityEntity()
         {
             RegionId  = community.RegionId,
             Name      = community.Name,
             Location  = community.Location,
             BuiltYear = community.BuiltYear,
             Traffic   = community.Traffic
         };
         db.Communities.Add(entity);
         db.SaveChanges();
     }
 }