示例#1
0
    public Arena()
    {
        instance = this;

        mapData = MapGenerator.Generate();

        FSprite bgSprite = new FSprite("Arena/BG_1");

        AddChild(bgSprite);

        AddChild(entityArea = new EntityArea());
        float inset = 13;

        entityArea.bounds.x      = -Config.WIDTH / 2 + inset;
        entityArea.bounds.y      = -Config.HEIGHT / 2 + inset;
        entityArea.bounds.width  = Config.WIDTH - inset * 2;
        entityArea.bounds.height = Config.HEIGHT - inset * 2;

        colorOverlay        = new FSprite("WhiteBox");
        colorOverlay.color  = new Color(1, 1, 1, 0);
        colorOverlay.width  = Config.WIDTH;
        colorOverlay.height = Config.HEIGHT;
        entityArea.overlayContainer.AddChild(colorOverlay);

        AddChild(frontContainer = new FContainer());

        dayManager = new DayManager();

        CreateBuildings();
        SetupPlayers();

        ListenForUpdate(Update);
    }
示例#2
0
        public BooksModule(EntityArea area) : base(area, "Books", "Books module", version: CurrentVersion)
        {
            RegisterEntities(typeof(IBook), typeof(IPublisher), typeof(IAuthor), typeof(IBookAuthor), typeof(IBookReview),
                             typeof(IUser), typeof(IBookOrder), typeof(IBookOrderLine), typeof(ICoupon), typeof(IImage));

            RegisterViews();
        }//method
示例#3
0
文件: Arena.cs 项目: BoarK/BewareWolf
    public Arena()
    {
        instance = this;

        mapData = MapGenerator.Generate();

        FSprite bgSprite = new FSprite("Arena/BG_1");
        AddChild(bgSprite);

        AddChild(entityArea = new EntityArea());
        float inset = 13;
        entityArea.bounds.x = -Config.WIDTH/2 + inset;
        entityArea.bounds.y = -Config.HEIGHT/2 + inset;
        entityArea.bounds.width = Config.WIDTH - inset*2;
        entityArea.bounds.height = Config.HEIGHT - inset*2;

        colorOverlay = new FSprite("WhiteBox");
        colorOverlay.color = new Color(1,1,1,0);
        colorOverlay.width = Config.WIDTH;
        colorOverlay.height = Config.HEIGHT;
        entityArea.overlayContainer.AddChild(colorOverlay);

        AddChild(frontContainer = new FContainer());

        dayManager = new DayManager();

        CreateBuildings();
        SetupPlayers();

        ListenForUpdate(Update);
    }
示例#4
0
文件: Wolf.cs 项目: BoarK/BewareWolf
    public Wolf(WolfActivePlayer player, EntityArea entityArea)
        : base(entityArea)
    {
        this.player = player;

        offsetY = 12f;

        body = new FContainer();
        bodySprite = new FSprite(WolfAnimation.Idle.frames[0]);
        body.AddChild(bodySprite);

        bodySprite.color = player.player.color.color + new Color(0.5f,0.5f,0.5f,0.0f);

        bodySprite.y = offsetY;

        body.scaleX = player.isFacingLeft ? 1f : -1f;
        //		colorSprite = new FSprite("Arena/Wolf_Idle1_color");
        //		colorSprite.color = player.player.color.color;
        //		body.AddChild(colorSprite);
        //
        shadowSprite = new FSprite("Arena/VillShadow");
        shadowSprite.alpha = 0.2f;
        shadowSprite.scaleX = 1.9f;
        shadowSprite.scaleY = 1.0f;
    }
示例#5
0
            // Alice created a constructor with extra parameter userEntityType
            // suggesting to provide a real type of User entity in the system.
            public LoginModule(EntityArea area, Type userEntityType) : base(area, "Login")
            {
                RegisterEntities(typeof(ILogin), typeof(IUserStub)); //still need to register IUserStub, to immediately replace it
                var serv = App.GetService <IEntityModelCustomizationService>();

                serv.ReplaceEntity(typeof(IUserStub), userEntityType);
            }
 /// <summary>Moves entities (types) from their original areas to the target Area. </summary>
 /// <param name="toArea">Target area.</param>
 /// <param name="entityTypes">Entity types.</param>
 public void MoveTo(EntityArea toArea, params Type[] entityTypes)
 {
     CheckNotClosed();
     foreach (var ent in entityTypes)
     {
         MovedEntities[ent] = toArea;
     }
 }
示例#7
0
 public OAuthClientModule(EntityArea area, OAuthClientSettings settings = null) : base(area, "OAuthClient", version: CurrentVersion)
 {
     Settings = settings ?? new OAuthClientSettings();
     this.App.RegisterConfig(this.Settings);
     RegisterEntities(typeof(IOAuthRemoteServer), typeof(IOAuthRemoteServerAccount), typeof(IOAuthAccessToken),
                      typeof(IOAuthClientFlow), typeof(IOAuthOpenIdToken), typeof(IOAuthExternalUser));
     App.RegisterService <IOAuthClientService>(this);
     Requires <EncryptedData.EncryptedDataModule>();
 }
示例#8
0
        public string GetSchema(EntityArea area)
        {
            string schema;

            if (SchemaMappings.TryGetValue(area.Name, out schema))
            {
                return(schema);
            }
            return(area.Name);
        }
示例#9
0
 public JobExecutionModule(EntityArea area, JobModuleSettings settings = null) : base(area, "JobRunner", version: CurrentVersion)
 {
     RegisterEntities(typeof(IJob), typeof(IJobRun), typeof(IJobSchedule));
     _settings          = settings ?? new JobModuleSettings();
     _activitiesCounter = new ThreadSafeCounter();
     App.RegisterConfig(_settings);
     App.RegisterService <IJobInformationService>(this);
     App.RegisterService <IJobExecutionService>(this);
     App.RegisterService <IJobDiagnosticsService>(this);
 }
示例#10
0
        private bool IsActive(EntityArea area)
        {
            return(true);

            /*
             * if(!_driver.Supports(DbFeatures.Schemas))
             * return true;
             * return _dbModel.ContainsSchema(area.Name);
             */
        }
示例#11
0
 public TransactionLogModule(EntityArea area, TransactionLogSettings settings = null, bool trackHostApp = true) : base(area, "TransactionLog", version: CurrentVersion)
 {
     Settings = settings ?? new TransactionLogSettings();
     App.RegisterConfig(Settings);
     RegisterEntities(typeof(ITransactionLog));
     App.RegisterService <ITransactionLogService>(this);
     if (trackHostApp)
     {
         SetupLoggingFor(this.App);
     }
 }
示例#12
0
    public House(float x, float y, EntityArea entityArea) : base(entityArea)
    {
        this.x = x;
        this.y = y;

        main         = new FContainer();
        mainSprite   = new FSprite("Arena/House_1");
        mainSprite.y = -offsetY;
        main.AddChild(mainSprite);

        blockingRect = new TORect(x - 40, y - 24, 80, 42);
    }
示例#13
0
    public FenceV(float x, float y, EntityArea entityArea) : base(entityArea)
    {
        this.x = x;
        this.y = y;

        main         = new FContainer();
        mainSprite   = new FSprite("Arena/fenceV_1");
        mainSprite.y = -offsetY;
        main.AddChild(mainSprite);

        blockingRect = new TORect(x - 4, y - 30, 8, 60);
        blockingRect.shouldBlockVills = false;
    }
示例#14
0
文件: House.cs 项目: BoarK/BewareWolf
    public House(float x, float y, EntityArea entityArea)
        : base(entityArea)
    {
        this.x = x;
        this.y = y;

        main = new FContainer();
        mainSprite = new FSprite("Arena/House_1");
        mainSprite.y = -offsetY;
        main.AddChild(mainSprite);

        blockingRect = new TORect(x-40,y-24,80,42);
    }
示例#15
0
    public FenceV(float x, float y, EntityArea entityArea)
        : base(entityArea)
    {
        this.x = x;
        this.y = y;

        main = new FContainer();
        mainSprite = new FSprite("Arena/fenceV_1");
        mainSprite.y = -offsetY;
        main.AddChild(mainSprite);

        blockingRect = new TORect(x-4,y-30,8,60);
        blockingRect.shouldBlockVills = false;
    }
示例#16
0
    public Vill(VillagerActivePlayer player, EntityArea entityArea) : base(entityArea)
    {
        this.player = player;

        attackCooldown = RXRandom.Float();         //random cooldown to start so they're not synced

        offsetY = 6f;

        int numArts = 8;

        artIndex = RXRandom.Range(0, numArts) + 1;

        body       = new FContainer();
        bodySprite = new FSprite("Arena/Vill" + artIndex + "_body");
        body.AddChild(bodySprite);

        colorSprite       = new FSprite("Arena/Vill" + artIndex + "_color");
        colorSprite.color = player.player.color.color;
        body.AddChild(colorSprite);

        weapon = new FContainer();
        body.AddChild(weapon);

        string weaponName = RXRandom.GetRandomString("RollingPin", "Torch", "Pitchfork", "", "", "", "");   //Rake, FryingPan

        if (weaponName != "" && artIndex != 8)
        {
            if (weaponName == "Torch")
            {
                var torch = new VillTorch();
                weapon.AddChild(torch);
            }
            else
            {
                FSprite weaponSprite = new FSprite("Arena/" + weaponName + "_1");
                weapon.AddChild(weaponSprite);
            }
        }


        shadowSprite        = new FSprite("Arena/VillShadow");
        shadowSprite.alpha  = 0.2f;
        shadowSprite.scaleX = 0.7f;
        shadowSprite.scaleY = 0.5f;

        hopper = new Hopper(this);
        hopper.config.jumpDist     = RXRandom.Range(18f, 19f);
        hopper.config.jumpDuration = RXRandom.Range(0.2f, 0.24f);
        hopper.config.jumpHeight   = RXRandom.Range(3f, 4f);
    }
示例#17
0
        // public readonly LoginAuthorizationRoles Roles;

        #region constructors and init
        public LoginModule(EntityArea area, LoginModuleSettings settings, string name = null) : base(area, name ?? "LoginModule", "Login module", version: CurrentVersion)
        {
            _settings = settings;
            App.RegisterConfig(_settings);
            //Register entities
            RegisterEntities(typeof(ILogin), typeof(ISecretQuestion), typeof(ISecretQuestionAnswer),
                             typeof(ITrustedDevice), typeof(ILoginExtraFactor), typeof(ILoginProcess));
            //Register services
            App.RegisterService <ILoginService>(this);
            App.RegisterService <ILoginProcessService>(this);
            App.RegisterService <ILoginManagementService>(this);
            App.RegisterService <ILoginAdministrationService>(this);
            RegisterSize("EventType", 50);
        }
示例#18
0
文件: Vill.cs 项目: BoarK/BewareWolf
    public Vill(VillagerActivePlayer player, EntityArea entityArea)
        : base(entityArea)
    {
        this.player = player;

        attackCooldown = RXRandom.Float(); //random cooldown to start so they're not synced

        offsetY = 6f;

        int numArts = 8;
        artIndex = RXRandom.Range(0,numArts)+1;

        body = new FContainer();
        bodySprite = new FSprite("Arena/Vill"+artIndex+"_body");
        body.AddChild(bodySprite);

        colorSprite = new FSprite("Arena/Vill"+artIndex+"_color");
        colorSprite.color = player.player.color.color;
        body.AddChild(colorSprite);

        weapon = new FContainer();
        body.AddChild(weapon);

        string weaponName = RXRandom.GetRandomString("RollingPin","Torch","Pitchfork","","","",""); //Rake, FryingPan

        if(weaponName != "" && artIndex != 8)
        {
            if(weaponName == "Torch")
            {
                var torch = new VillTorch();
                weapon.AddChild(torch);
            }
            else
            {
                FSprite weaponSprite = new FSprite("Arena/"+weaponName+"_1");
                weapon.AddChild(weaponSprite);
            }
        }

        shadowSprite = new FSprite("Arena/VillShadow");
        shadowSprite.alpha = 0.2f;
        shadowSprite.scaleX = 0.7f;
        shadowSprite.scaleY = 0.5f;

        hopper = new Hopper(this);
        hopper.config.jumpDist = RXRandom.Range(18f,19f);
        hopper.config.jumpDuration = RXRandom.Range(0.2f,0.24f);
        hopper.config.jumpHeight = RXRandom.Range(3f,4f);
    }
示例#19
0
 public EntityInfo(EntityModule module, Type entityType, EntityKind kind = EntityKind.Table, EntityArea altArea = null)
 {
     Module     = module;
     EntityType = entityType;
     Area       = altArea ?? Module.Area;
     Kind       = kind;
     Name       = entityType.Name;
     Members    = new List <EntityMemberInfo>();
     Events     = new EntityEvents();
     //Check for generic types - happens in modules with generic entities (interfaces), provided for customization
     if (Name.Contains('`'))
     {
         Name = Name.Substring(0, Name.IndexOf('`'));
     }
     if (EntityType.IsInterface && Name.Length > 1 && Name.StartsWith("I"))
     {
         Name = Name.Substring(1);
     }
     FullName          = Area.Name + "." + Name;
     EntitySetConstant = ExpressionMaker.MakeEntitySetConstant(this.EntityType);
 }
示例#20
0
 public LoginModule(EntityArea area, LoginModuleSettings settings, string name = null) : base(area, name ?? "LoginModule", "Login module", version: CurrentVersion)
 {
     _settings = settings;
     App.RegisterConfig(_settings);
     //Register entities
     RegisterEntities(typeof(ILogin), typeof(ISecretQuestion), typeof(ISecretQuestionAnswer), typeof(ITrustedDevice),
                      typeof(ILoginExtraFactor), typeof(IPasswordHistory), typeof(ILoginProcess));
     //Register services
     App.RegisterService <ILoginService>(this);
     App.RegisterService <ILoginProcessService>(this);
     App.RegisterService <ILoginManagementService>(this);
     App.RegisterService <ILoginAdministrationService>(this);
     RegisterSize("EventType", 50);
     Roles = new LoginAuthorizationRoles();
     // Create recaptcha service if settings are there
     if (_settings.Recaptcha != null)
     {
         var recaptcha = new RecaptchaService(_settings.Recaptcha);
         App.RegisterService <IRecaptchaService>(recaptcha);
     }
 }
示例#21
0
文件: Human.cs 项目: BoarK/BewareWolf
    public Human(WolfActivePlayer player, EntityArea entityArea, bool shouldStartWithTransform)
        : base(entityArea)
    {
        this.player = player;

        isTransformingFromWolf = shouldStartWithTransform;
        tranPercent = 0.0f;

        offsetY = 18f;

        body = new FContainer();
        bodySprite = new FSprite(HumanAnimation.Idle.frames[0]);
        body.AddChild(bodySprite);

        bodySprite.color = player.player.color.color + new Color(0.7f,0.7f,0.7f,0.0f);

        bodySprite.y = offsetY;

        body.scaleX = player.isFacingLeft ? 1f : -1f;

        //		colorSprite = new FSprite("Arena/Human_Idle1_color");
        //		colorSprite.color = player.player.color.color;
        //		body.AddChild(colorSprite);

        shadowSprite = new FSprite("Arena/VillShadow");
        shadowSprite.alpha = 0.2f;
        shadowSprite.scaleX = 1.9f;
        shadowSprite.scaleY = 1.0f;

        attackableRect = new TORect(0,0,62,29);

        healthBar = new HumanHealthBar(this);
        healthBar.alpha = 0.0f;

        Go.to(healthBar, 1.0f, new TweenConfig().alpha(1.0f));

        float healthPercent = ((float)player.health / (float)Config.HUMAN_MAX_HEALTH);
        healthBar.SetPercent(healthPercent);
    }
示例#22
0
        public BooksModule(EntityArea area) : base(area, "Books", "Books module", version: CurrentVersion)
        {
            RegisterEntities(typeof(IBook), typeof(IPublisher), typeof(IAuthor), typeof(IBookAuthor), typeof(IBookReview),
                             typeof(IUser), typeof(IBookOrder), typeof(IBookOrderLine), typeof(ICoupon), typeof(IImage));

            /*
             * //Add extra tracking columns in book, order, coupon entities
             * var tranLogExt = new TransactionLogModelExtender();
             * tranLogExt.AddUpdateStampColumns(new[] { typeof(IBook), typeof(IBookOrder), typeof(IBookOrderLine), typeof(ICoupon) },
             * createIdPropertyName: "CreatedIn", updateIdPropertyName: "UpdatedIn");
             * App.ModelExtenders.Add(tranLogExt);
             */

            //Set cached types
            // App.CacheSettings.AddCachedTypes(CacheType.FullSet, typeof(IBook), typeof(IPublisher), typeof(IAuthor), typeof(IBookAuthor));
            // App.CacheSettings.AddCachedTypes(CacheType.Sparse, typeof(IBookOrder), typeof(IBookOrderLine), typeof(IUser), typeof(IImage));

            //Register api controllers
            App.ApiConfiguration.RegisterControllerTypes(typeof(CatalogController), typeof(UserAccountController), typeof(SignupController), typeof(DiagnosticsController));

            RegisterViews();
        }//method
示例#23
0
    public Human(WolfActivePlayer player, EntityArea entityArea, bool shouldStartWithTransform) : base(entityArea)
    {
        this.player = player;

        isTransformingFromWolf = shouldStartWithTransform;
        tranPercent            = 0.0f;

        offsetY = 18f;

        body       = new FContainer();
        bodySprite = new FSprite(HumanAnimation.Idle.frames[0]);
        body.AddChild(bodySprite);

        bodySprite.color = player.player.color.color + new Color(0.7f, 0.7f, 0.7f, 0.0f);

        bodySprite.y = offsetY;

        body.scaleX = player.isFacingLeft ? 1f : -1f;

        //		colorSprite = new FSprite("Arena/Human_Idle1_color");
        //		colorSprite.color = player.player.color.color;
        //		body.AddChild(colorSprite);

        shadowSprite        = new FSprite("Arena/VillShadow");
        shadowSprite.alpha  = 0.2f;
        shadowSprite.scaleX = 1.9f;
        shadowSprite.scaleY = 1.0f;

        attackableRect = new TORect(0, 0, 62, 29);

        healthBar       = new HumanHealthBar(this);
        healthBar.alpha = 0.0f;

        Go.to(healthBar, 1.0f, new TweenConfig().alpha(1.0f));

        float healthPercent = ((float)player.health / (float)Config.HUMAN_MAX_HEALTH);

        healthBar.SetPercent(healthPercent);
    }
示例#24
0
 public EntityInfo(EntityModule module, Type entityType, EntityKind kind = EntityKind.Table)
 {
     Module     = module;
     EntityType = entityType;
     Kind       = kind;
     Name       = entityType.Name;
     //Check for generic types - happens in modules with generic entities (interfaces), provided for customization
     if (Name.Contains('`'))
     {
         Name = Name.Substring(0, Name.IndexOf('`'));
     }
     if (EntityType.IsInterface && Name.Length > 1 && Name.StartsWith("I"))
     {
         Name = Name.Substring(1);
     }
     //check if entity was moved
     if (!module.App.MovedEntities.TryGetValue(entityType, out this.Area))
     {
         Area = Module.Area;
     }
     FullName = Area.Name + "." + Name;
 }
示例#25
0
        public BooksModule(EntityArea area) : base(area, "Books", "Books module", version: CurrentVersion)
        {
            Requires <JobExecutionModule>();

            RegisterEntities(typeof(IBook), typeof(IPublisher), typeof(IAuthor), typeof(IBookAuthor), typeof(IBookReview),
                             typeof(IUser), typeof(IBookOrder), typeof(IBookOrderLine), typeof(ICoupon), typeof(IImage));

            //Register companion types that describe keys and indexes on entities
            RegisterCompanionTypes(
                typeof(IBookKeys), typeof(IAuthorKeys), typeof(IPublisherKeys));
            //Add extra tracking columns in book, order, coupon entities
            var tranLogExt = new TransactionLogModelExtender();

            tranLogExt.AddUpdateStampColumns(new[] { typeof(IBook), typeof(IBookOrder), typeof(IBookOrderLine), typeof(ICoupon) },
                                             createIdPropertyName: "CreatedIn", updateIdPropertyName: "UpdatedIn");
            App.ModelExtenders.Add(tranLogExt);
            //Set cached types
            App.CacheSettings.AddCachedTypes(CacheType.FullSet, typeof(IBook), typeof(IPublisher), typeof(IAuthor), typeof(IBookAuthor));
            App.CacheSettings.AddCachedTypes(CacheType.Sparse, typeof(IBookOrder), typeof(IBookOrderLine), typeof(IUser), typeof(IImage));
            //Register api controllers
            App.ApiConfiguration.RegisterControllerTypes(typeof(CatalogController), typeof(UserAccountController), typeof(SignupController));

            RegisterViews();
        }//method
示例#26
0
    public Wolf(WolfActivePlayer player, EntityArea entityArea) : base(entityArea)
    {
        this.player = player;

        offsetY = 12f;

        body       = new FContainer();
        bodySprite = new FSprite(WolfAnimation.Idle.frames[0]);
        body.AddChild(bodySprite);

        bodySprite.color = player.player.color.color + new Color(0.5f, 0.5f, 0.5f, 0.0f);

        bodySprite.y = offsetY;

        body.scaleX = player.isFacingLeft ? 1f : -1f;
//		colorSprite = new FSprite("Arena/Wolf_Idle1_color");
//		colorSprite.color = player.player.color.color;
//		body.AddChild(colorSprite);
//
        shadowSprite        = new FSprite("Arena/VillShadow");
        shadowSprite.alpha  = 0.2f;
        shadowSprite.scaleX = 1.9f;
        shadowSprite.scaleY = 1.0f;
    }
示例#27
0
 public LoginLogModule(EntityArea area, string name = "LoginLog", string description = null) : base(area, name, description, version: CurrentVersion)
 {
     RegisterEntities(typeof(ILoginLog));
     App.RegisterService <ILoginLogService>(this);
 }
示例#28
0
 public EntityCommand(string commandName, string description, EntityCommandKind kind, Type entityType, EntityArea area) :
     this(commandName, description, kind)
 {
     TargetEntityType = entityType;
     Area             = area;
 }
示例#29
0
 public IncidentLogModule(EntityArea area, string name = "IncidentLog") : base(area, name, version: CurrentVersion)
 {
     RegisterEntities(typeof(IIncidentLog), typeof(IIncidentAlert));
     App.RegisterService <IIncidentLogService>(this);
 }
示例#30
0
 public Entity(EntityArea entityArea)
 {
     this.entityArea = entityArea;
 }
示例#31
0
 public PersonModule(EntityArea area)
     : base(area, "PersonModule")
 {
     RegisterEntities(typeof(IPerson));
 }
示例#32
0
 public LockTestModule(EntityArea area)  : base(area, "LockTestModule", version: new Version("1.0.0.0"))
 {
     RegisterEntities(typeof(IDoc), typeof(IDocDetail));
 }
示例#33
0
 public AppEventLogModule(EntityArea area) : base(area, "AppEventLog", "App events log.", CurrentVersion)
 {
     RegisterEntities(typeof(IAppEvent));
 }
示例#34
0
        public List<string> UpdateMemberNames; //For PartialUpdate - names of members to update

        #endregion Fields

        #region Constructors

        public EntityCommand(string commandName, string description, EntityCommandKind kind, Type entityType, EntityArea area)
            : this(commandName, description, kind)
        {
            TargetEntityType = entityType;
              Area = area;
        }
示例#35
0
 public DbInfoModule(EntityArea area) : base(area, "DbInfo", version: CurrentVersion)
 {
     RegisterEntities(typeof(IDbInfo), typeof(IDbModuleInfo));
     App.RegisterService <IDbInfoService>(this);
 }
 public EntityModuleBooks(EntityArea area) : base(area, "EntityModuleBooks", version: CurrentVersion)
 {
     base.RegisterEntities(
         typeof(Object));
 }
示例#37
0
 // Alice created a constructor with extra parameter userEntityType
 // suggesting to provide a real type of User entity in the system.
 public LoginModule(EntityArea area, Type userEntityType)
     : base(area, "Login")
 {
     RegisterEntities(typeof(ILogin), typeof(IUserStub)); //still need to register IUserStub, to immediately replace it
     App.ReplaceEntity(typeof(IUserStub), userEntityType);
 }
示例#38
0
 public UserSessionModule(EntityArea area, UserSessionSettings settings = null, string name = "UserSessionModule")
     : base(area, settings, name)
 {
 }
示例#39
0
 public DbUpgradeLogModule(EntityArea area, string name = "DbUpgradeLog") : base(area, name, version: CurrentVersion)
 {
     RegisterEntities(EntityTypes);
     App.RegisterService <IDbUpgradeLogService>(this);
 }
示例#40
0
 public AddressPhoneModule(EntityArea area, string name = "AddressPhone")  : base(area, name)
 {
 }