Ejemplo n.º 1
0
        public override void LoadContent(ContentManager content)
        {
            _managerMap.LoadContent(content);

            BaseObject player = new BaseObject();

            player.AddComponent(new Sprite(content.Load <Texture2D>("Sprites/link_full"), 16, 16, new Vector2(50, 60)));
            player.AddComponent(new PlayerInput());
            player.AddComponent(new Animation(16, 16));
            player.AddComponent(new Collision(_managerMap));
            player.AddComponent(new Camera(_managerCamera));

            BaseObject testNPC = new BaseObject();

            testNPC.AddComponent(new Sprite(content.Load <Texture2D>("Sprites/Marin"), 16, 16, new Vector2(60, 20)));
            testNPC.AddComponent(new AIMovementRandom(200));
            testNPC.AddComponent(new Animation(16, 16));
            testNPC.AddComponent(new Collision(_managerMap));
            testNPC.AddComponent(new Camera(_managerCamera));

            BaseObject testEnemy = new BaseObject();

            testEnemy.AddComponent(new Sprite(content.Load <Texture2D>("Sprites/Octorok"), 16, 16, new Vector2(80, 20)));
            testEnemy.AddComponent(new AIMovementRandom(1000, 0.5f));
            testEnemy.AddComponent(new Animation(16, 16));
            testEnemy.AddComponent(new Collision(_managerMap));
            testEnemy.AddComponent(new Octorok(player, content.Load <Texture2D>("Sprites/Octorok_bullet"), _managerMap));
            testEnemy.AddComponent(new Camera(_managerCamera));

            _entities.AddEntity(player);
            _entities.AddEntity(testNPC);
            _entities.AddEntity(testEnemy);
        }
Ejemplo n.º 2
0
        public override void LoadContent(ContentManager content)
        {
            _mapController.LoadContent(content);

            var player = new BaseObject();

            player.AddComponent(new Sprite(content.Load <Texture2D>("Sprites\\spr_link_full"), 16, 16, new Vector2(50, 50)));
            player.AddComponent(new PlayerInput());
            player.AddComponent(new Animation(16, 16));
            player.AddComponent(new Collision(_mapController));
            player.AddComponent(new Camera(_cameraController));

            var testNPC = new BaseObject();

            testNPC.AddComponent(new Sprite(content.Load <Texture2D>("Sprites\\spr_marin_full"), 16, 16, new Vector2(50, 50)));
            testNPC.AddComponent(new AIRandomMovement(500, 0.5f));
            testNPC.AddComponent(new Animation(16, 16));
            testNPC.AddComponent(new Collision(_mapController));
            testNPC.AddComponent(new Camera(_cameraController));

            var testEnemy = new BaseObject();

            testEnemy.AddComponent(new Sprite(content.Load <Texture2D>("Sprites\\spr_octorok_full"), 16, 16, new Vector2(50, 50)));
            testEnemy.AddComponent(new AIRandomMovement(1000, 0.5f));
            testEnemy.AddComponent(new Animation(16, 16));
            testEnemy.AddComponent(new Collision(_mapController));
            testEnemy.AddComponent(new Octorok(player, content.Load <Texture2D>("Sprites\\spr_octorok_bullet"), _mapController));
            testEnemy.AddComponent(new Camera(_cameraController));

            _entities.AddEntity(player);
            _entities.AddEntity(testNPC);
            _entities.AddEntity(testEnemy);
        }
        public List <Text> scores;                                           // List of Text EntityComponents to display scores.

        public override void Initialize()
        {
            base.Initialize();
            // Initialize lists.
            names  = new List <Text>();
            scores = new List <Text>();
            // Add new Background Entity to scene.
            Entities.AddEntity <Background>();

            Entities.AddEntity <ScoreBackground>();
            Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(750f, 50f));
            // Create a text element that says "High Scores!!!!!" at position 900,50
            CreateNewText("High Scores!!!!!", new Vector2(900f, 50f));
            // Set an initial starting position for the Scoreboard.
            Vector2 textPosition = new Vector2(800f, 150f);

            // Loop through and create the actual scoreboard. Holds a maximum of 10 values.
            for (int i = 0; i < 10; i++)
            {
                // Text position for this particular element is in the same horizontal position as initial point,
                // but is 50 pixels lower per index.
                Vector2 newTextPosition = textPosition + new Vector2(0f, 50f * i);
                // Create an empty text entity at that position.
                CreateNewText(newTextPosition);
                // Add the empty Text entity to the list of names.
                names.Add(Entities.Entities[Entities.Entities.Count - 1].GetComponent <Text>() as Text);
                // Text position for this particular element is in the same horizontal position as initial point + 200 pixels,
                // and is 50 pixels lower per index.
                newTextPosition = textPosition + new Vector2(200f, 50f * i);
                // Create an empty text entity at that position.
                CreateNewText(newTextPosition);
                // and add it to the list of scores.
                scores.Add(Entities.Entities[Entities.Entities.Count - 1].GetComponent <Text>() as Text);
            }
        }
Ejemplo n.º 4
0
        private void Initialize()
        {
#if DEBUG
            DebugUtils.CreateShortcuts(this);
            DebugDisp = DebugUtils.CreateDisplay(this);
#endif
            AddAgent(new ExitAgent(this));

            OverworldNode[] nodes =
            {
                new OverworldNode_Tutorial(this, FPoint.Zero),
                new OverworldNode_W1(this,       FPoint.Zero),
                new OverworldNode_W2(this,       FPoint.Zero),
                new OverworldNode_W3(this,       FPoint.Zero),
                new OverworldNode_W4(this,       FPoint.Zero),
                new OverworldNode_MP(this,       FPoint.Zero),
            };

            foreach (var node in nodes)
            {
                Entities.AddEntity(node);
            }

            AddAgent(ScrollAgent = new OverworldScrollAgent(this, nodes));

            _banner.TargetRect          = new FRectangle(0 * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH, 16 * GDConstants.TILE_WIDTH, 4 * GDConstants.TILE_WIDTH).AsDeflated(0.25f * GDConstants.TILE_WIDTH);
            _banner.Text                = GDConstants.LOGO_STRING;
            _banner.UseCPUParticles     = false;
            _banner.AnimationTime       = 4f;
            _banner.AnimationStartDelay = 1f;
            _banner.CreateEntities(ParticlePresets.GetConfigLetterGreenGas());
        }
Ejemplo n.º 5
0
        private void Initialize()
        {
#if DEBUG
            DebugUtils.CreateShortcuts(this);
            DebugDisp = DebugUtils.CreateDisplay(this);
#endif

            _banner1.TargetRect          = new FRectangle(0, 2.5f, 16, 2).AsDeflated(0.25f).InReferenceRaster(1f / GDConstants.TILE_WIDTH);
            _banner1.Text                = L10N.T(L10NImpl.STR_ENDGAME_1);
            _banner1.UseCPUParticles     = false;
            _banner1.AnimationTime       = 4f;
            _banner1.AnimationStartDelay = 5f;
            _banner1.CreateEntities(ParticlePresets.GetConfigLetterFlickerFire());

            _banner2.TargetRect          = new FRectangle(0, 5.5f, 16, 2).AsDeflated(0.25f).InReferenceRaster(1f / GDConstants.TILE_WIDTH);
            _banner2.Text                = L10N.T(L10NImpl.STR_ENDGAME_2);
            _banner2.UseCPUParticles     = false;
            _banner2.AnimationTime       = 4f;
            _banner2.AnimationStartDelay = 9f;
            _banner2.CreateEntities(ParticlePresets.GetConfigLetterFlickerFire());

            Entities.AddEntity(new MouseAreaEntity(this, new FPoint(VIEW_WIDTH / 2f, VIEW_HEIGHT / 2f), new FSize(VIEW_WIDTH * 2, VIEW_HEIGHT * 2), 0)
            {
                Click = LeaveScreen
            });
        }
Ejemplo n.º 6
0
 public override void Initialize()
 {
     base.Initialize();
     Entities.AddEntity <Background>();
     Entities.AddEntity <Floor>();
     Entities.AddEntity <Player>();
     Entities.AddEntity <UpperFloor>();
     Entities.AddEntity <UpperFloor>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(240f, 620f));
     Entities.AddEntity <UpperFloor>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(240f, 400f));
     Entities.AddEntity <Score>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(850f, 150f));
     Entities.AddEntity <Patient>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(800f, 800f));
     Entities.AddEntity <Patient>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(500f, 1000f));
     Entities.AddEntity <Patient>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(1000f, 0f));
     Entities.AddEntity <Patient>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(400f, 400f));
     Entities.AddEntity <Patient>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(1200f, 800f));
     Entities.AddEntity <Patient>();
     Entities.Entities[Entities.Entities.Count - 1].transform.SetPosition(new Vector2(1200f, 200f));
 }
        public void CreateNewText(Vector2 position)
        {
            // Create an Entity with an empty Text component, at the position specified.
            Entities.AddEntity <ScoreDisplay>();
            IEntity entity = Entities.Entities[Entities.Entities.Count - 1];

            entity.transform.SetPosition(position);
        }
Ejemplo n.º 8
0
        public static int Retrieve(Entities ens, string sql)
        {
            try
            {
                DataTable dt = new DataTable();
                switch (ens.GetNewEntity.EnMap.EnDBUrl.DBUrlType)
                {
                case DBUrlType.AppCenterDSN:
                    dt = DBAccess.RunSQLReturnTable(sql);
                    break;

                case DBUrlType.DBAccessOfMSMSSQL:
                    dt = DBAccessOfMSMSSQL.RunSQLReturnTable(sql);
                    break;

                case DBUrlType.DBAccessOfOracle:
                    dt = DBAccessOfOracle.RunSQLReturnTable(sql);
                    break;

                case DBUrlType.DBAccessOfOLE:
                    dt = DBAccessOfOLE.RunSQLReturnTable(sql);
                    break;

                default:
                    throw new Exception("@没有设置DB类型。");
                }

                if (dt.Rows.Count == 0)
                {
                    return(0);
                }

                Map   enMap = ens.GetNewEntity.EnMap;
                Attrs attrs = enMap.Attrs;

                //Entity  en1 = ens.GetNewEntity;
                foreach (DataRow dr in dt.Rows)
                {
                    Entity en = ens.GetNewEntity;
                    //Entity  en = en1.CreateInstance();
                    foreach (Attr attr in attrs)
                    {
                        en.Row.SetValByKey(attr.Key, dr[attr.Key]);
                    }
                    ens.AddEntity(en);
                }
                int i = dt.Rows.Count;
                dt.Dispose();
                return(i);
                //return dt.Rows.Count;
            }
            catch (System.Exception ex)
            {
                // ens.GetNewEntity.CheckPhysicsTable();
                throw new Exception("@在[" + ens.GetNewEntity.EnDesc + "]查询时出现错误:" + ex.Message);
            }
        }
    public override void OnStart()
    {
        base.OnStart();
        Entities.AddEntity(typeof(MatchComponent));
        Entity character = Entities.AddEntity(typeof(PositionComponent), typeof(MovingComponent), typeof(InputControlComponent));

        character.GetComponent <PositionComponent>().Position = Vector2.zero;
        character.GetComponent <MovingComponent>().IsMoving   = false;
        character.GetComponent <MovingComponent>().Speed      = 1;
    }
        public void CreateNewText(string textValue, Vector2 position)
        {
            // Create an Entity with a Text component, at the position specified.
            // and give it a text value.
            Entities.AddEntity <ScoreDisplay>();
            IEntity entity = Entities.Entities[Entities.Entities.Count - 1];

            entity.transform.SetPosition(position);
            Text text = entity.GetComponent <Text>() as Text;

            text.SetText(textValue);
        }
Ejemplo n.º 11
0
        private void Initialize()
        {
#if DEBUG
            DebugUtils.CreateShortcuts(this);
            DebugDisp = DebugUtils.CreateDisplay(this);
#endif

            if (!MonoSAMGame.IsIOS())
            {
                AddAgent(new ExitAgent());
            }

            List <OverworldNode> nodesList = new List <OverworldNode>();

            nodesList.Add(new OverworldNode_Tutorial(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W1(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W2(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W3(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W4(this, FPoint.Zero));
            if (MainGame.Flavor != GDFlavor.FREE && MainGame.Flavor != GDFlavor.FULL_NOMP && MainGame.Flavor != GDFlavor.IAB_NOMP)
            {
                nodesList.Add(new OverworldNode_MP(this, FPoint.Zero));
            }
            if (MainGame.Flavor != GDFlavor.FREE)
            {
                nodesList.Add(new OverworldNode_SCCM(this, FPoint.Zero));
            }

            foreach (var node in nodesList)
            {
                Entities.AddEntity(node);
            }

            AddAgent(ScrollAgent = new OverworldScrollAgent(nodesList.ToArray()));

            _banner.TargetRect          = new FRectangle(0 * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH, 16 * GDConstants.TILE_WIDTH, 4 * GDConstants.TILE_WIDTH).AsDeflated(0.25f * GDConstants.TILE_WIDTH);
            _banner.Text                = GDConstants.LOGO_STRING;
            _banner.UseCPUParticles     = false;
            _banner.AnimationTime       = 4f;
            _banner.AnimationStartDelay = 1f;

            if (!MainGame.IsShaderless())
            {
                _banner.CreateEntities(ParticlePresets.GetConfigLetterGreenGas());
            }
        }
Ejemplo n.º 12
0
        protected virtual void ReduceHealth(int damage)
        {
            var stats = GetComponent <Stats>(ComponentType.Stats);

            if (stats == null)
            {
                return;
            }
            stats.ReduceHealth(damage);
            if (stats.CurrentHealth <= 0)
            {
                var sprite = GetComponent <Sprite>(ComponentType.Sprite);
                if (sprite == null)
                {
                    return;
                }
                _entities.AddEntity(FactoryDeathAnimation.GetDeathAnimationObject(DeathAnimation.Explosion,
                                                                                  sprite.Position));
            }
        }
Ejemplo n.º 13
0
        private void Initialize()
        {
#if DEBUG
            DebugUtils.CreateShortcuts(this);
            DebugDisp = DebugUtils.CreateDisplay(this);
#endif

#if !__IOS__
            AddAgent(new ExitAgent(this));
#endif

            List <OverworldNode> nodesList = new List <OverworldNode>();

            nodesList.Add(new OverworldNode_Tutorial(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W1(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W2(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W3(this, FPoint.Zero));
            nodesList.Add(new OverworldNode_W4(this, FPoint.Zero));
            if (GDConstants.FLAVOR != GDFlavor.FREE && GDConstants.FLAVOR != GDFlavor.FULL_NOMP)
            {
                nodesList.Add(new OverworldNode_MP(this, FPoint.Zero));
            }

            foreach (var node in nodesList)
            {
                Entities.AddEntity(node);
            }

            AddAgent(ScrollAgent = new OverworldScrollAgent(this, nodesList.ToArray()));

            _banner.TargetRect          = new FRectangle(0 * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH, 16 * GDConstants.TILE_WIDTH, 4 * GDConstants.TILE_WIDTH).AsDeflated(0.25f * GDConstants.TILE_WIDTH);
            _banner.Text                = GDConstants.LOGO_STRING;
            _banner.UseCPUParticles     = false;
            _banner.AnimationTime       = 4f;
            _banner.AnimationStartDelay = 1f;

#if !GD_SHADERLESS
            _banner.CreateEntities(ParticlePresets.GetConfigLetterGreenGas());
#endif
        }
Ejemplo n.º 14
0
        private void LoadLevelFromBlueprint()
        {
            Fraction[] fracList = { fractionNeutral, fractionPlayer, fractionComputer1, fractionComputer2, fractionComputer3 };

            //----------------------------------------------------------------

            MapFullBounds      = new FRectangle(0, 0, Blueprint.LevelWidth, Blueprint.LevelHeight);
            MapViewportCenterX = Blueprint.LevelViewX;
            MapViewportCenterY = Blueprint.LevelViewY;
            WrapMode           = (GameWrapMode)Blueprint.WrapMode;

            if (WrapMode == GameWrapMode.Donut || WrapMode == GameWrapMode.Reflect)
            {
                VAdapterGame.ChangeVirtualSize(GDConstants.VIEW_WIDTH + GDConstants.TILE_WIDTH, GDConstants.VIEW_HEIGHT + GDConstants.TILE_WIDTH);
                MapViewportCenterX = Blueprint.LevelViewX;
                MapViewportCenterY = Blueprint.LevelViewY;
            }

            if (MainGame.Inst.Profile.EffectsEnabled && WrapMode == GameWrapMode.Donut)
            {
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.NN));
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.EE));
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.SS));
                Entities.AddEntity(new DonutParticleEmitter(this, Blueprint, FlatAlign4.WW));
            }

            if (MainGame.Inst.Profile.EffectsEnabled)
            {
                Background = new GDCellularBackground(this, Blueprint);
            }
            else
            {
                Background = new GDStaticGridBackground(this, WrapMode);
            }

            //----------------------------------------------------------------

            var cannonList   = new List <Cannon>();
            var portalList   = new List <Portal>();
            var fractionList = new List <Fraction>();
            var laserworld   = false;

            fractionList.Add(fractionNeutral);

            foreach (var bPrint in Blueprint.BlueprintCannons)
            {
                var e = new BulletCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintMinigun)
            {
                var e = new MinigunCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintRelayCannon)
            {
                var e = new RelayCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintTrishotCannon)
            {
                var e = new TrishotCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintVoidWalls)
            {
                var e = new VoidWall(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintVoidCircles)
            {
                var e = new VoidCircle(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintGlassBlocks)
            {
                var e = new GlassBlock(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintBlackHoles)
            {
                var e = new BlackHole(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintPortals)
            {
                var e = new Portal(this, bPrint);
                Entities.AddEntity(e);
                portalList.Add(e);
            }

            foreach (var bPrint in Blueprint.BlueprintLaserCannons)
            {
                var e = new LaserCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);
                laserworld = true;

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintShieldProjector)
            {
                var e = new ShieldProjectorCannon(this, bPrint, fracList);
                Entities.AddEntity(e);
                cannonList.Add(e);
                laserworld = true;

                if (!fractionList.Contains(e.Fraction))
                {
                    fractionList.Add(e.Fraction);
                }
            }

            foreach (var bPrint in Blueprint.BlueprintMirrorBlocks)
            {
                var e = new MirrorBlock(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintMirrorCircles)
            {
                var e = new MirrorCircle(this, bPrint);
                Entities.AddEntity(e);
            }

            foreach (var bPrint in Blueprint.BlueprintBackgroundText)
            {
                var e = new BackgroundText(this, bPrint);
                Entities.AddEntity(e);
            }

            //----------------------------------------------------------------

            if (laserworld)
            {
                Entities.AddEntity(new LaserRenderer(this, LaserNetwork, Blueprint));
            }

            AddEdgeMarker();

            //----------------------------------------------------------------

            foreach (var cannon in cannonList)
            {
                cannon.OnAfterLevelLoad();
            }


            foreach (var portal in portalList)
            {
                portal.OnAfterLevelLoad(portalList);
            }

            CannonMap = cannonList.ToDictionary(p => p.BlueprintCannonID, p => p);

            foreach (var f in fracList)
            {
                if (!fractionList.Contains(f))
                {
                    fractionList.Add(f);
                }
            }
            fractionIDList = fractionList.ToArray();

            //----------------------------------------------------------------

            if (!IsPreview && (Blueprint.LevelWidth > GDConstants.VIEW_WIDTH || Blueprint.LevelHeight > GDConstants.VIEW_HEIGHT))
            {
                AddAgent(new GameDragAgent(this));
            }
        }
Ejemplo n.º 15
0
    public void Bind()
    {
        #region 生成标题
        Entity en  = this.HisEn;
        Map    map = this.HisEn.EnMap;
        EnCfg  cfg = new EnCfg(en.ToString());

        UIConfig uicfg = new UIConfig(en);

        Attrs attrs = map.Attrs;
        if (attrs.Count >= 4)
        {
            this.ucsys1.Add("<table border=0 cellpadding='0'  style='border-collapse: collapse;width:100%' cellspacing='0'  >");
        }
        else
        {
            this.ucsys1.Add("<table border=0 cellpadding='0'  style='border-collapse: collapse;width:50%' cellspacing='0'  >");
        }

        this.ucsys1.AddTR();
        CheckBox cb   = new CheckBox();
        string   str1 = "<INPUT id='checkedAll' onclick='SelectAll()' type='checkbox' name='checkedAll'>";
        this.ucsys1.AddTDGroupTitle(str1);
        foreach (Attr attr in attrs)
        {
            if (attr.UIVisible == false)
            {
                continue;
            }
            this.ucsys1.AddTDGroupTitle(attr.Desc);
        }

        if (map.IsHaveFJ)
        {
            this.ucsys1.AddTDGroupTitle("附件");
        }
        this.ucsys1.AddTDGroupTitle();
        this.ucsys1.AddTREnd();
        #endregion 生成标题

        this.Title = en.EnDesc;

        Entities    ens = this.HisEns;
        QueryObject qo  = new QueryObject(ens);

        #region 用户界面属性设置- del
        //BP.Web.Comm.UIRowStyleGlo tableStyle = (UIRowStyleGlo)ens.GetEnsAppCfgByKeyInt("UIRowStyleGlo"); // 界面风格。
        //bool IsEnableDouclickGlo = ens.GetEnsAppCfgByKeyBoolen("IsEnableDouclickGlo"); // 是否启用双击
        //bool IsEnableRefFunc = ens.GetEnsAppCfgByKeyBoolen("IsEnableRefFunc"); // 是否显示相关功能。
        //bool IsEnableFocusField = ens.GetEnsAppCfgByKeyBoolen("IsEnableFocusField"); //是否启用焦点字段。
        //bool isShowOpenICON = ens.GetEnsAppCfgByKeyBoolen("IsEnableOpenICON"); //是否启用 OpenICON 。
        //string FocusField = null;
        //if (IsEnableFocusField)
        //    FocusField = ens.GetEnsAppCfgByKeyString("FocusField");

        //int WinCardH = ens.GetEnsAppCfgByKeyInt("WinCardH"); // 弹出窗口高度
        //int WinCardW = ens.GetEnsAppCfgByKeyInt("WinCardW"); // 弹出窗口宽度.
        #endregion 用户界面属性设置

        #region 生成翻页
        try
        {
            this.ucsys2.Clear();
            this.ucsys2.BindPageIdx(qo.GetCount(), BP.Sys.SystemConfig.PageSize, this.PageIdx, "Ens.aspx?EnsName=" + this.EnsName);
            qo.DoQuery(en.PK, BP.Sys.SystemConfig.PageSize, this.PageIdx, false);
        }
        catch (Exception ex)
        {
            //自动创建表.
            Log.DebugWriteInfo(ex.Message);

            ens.GetNewEntity.CheckPhysicsTable();
            return;
        }
        #endregion 生成翻页

        en.PKVal = "0";
        ens.AddEntity(en);
        DDL  ddl = new DDL();
        bool is1 = false;

        #region 生成数据
        int i = 0;
        foreach (Entity dtl in ens)
        {
            string urlExt = "\"javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + ens.ToString() + "&PK=" + dtl.PKVal + "', 'cd');\"";
            i++;
            if (Equals(dtl.PKVal, "0"))
            {
                this.ucsys1.AddTRSum();
                this.ucsys1.AddTDIdx("<b>*</b>");
            }
            else
            {
                is1     = this.ucsys1.AddTR(is1, "ondblclick=" + urlExt);
                cb      = new CheckBox();
                cb.ID   = "IDX_" + dtl.PKVal;
                cb.Text = i.ToString();
                this.ucsys1.AddTDIdx(cb);
            }
            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                if (attr.Key == "OID")
                {
                    continue;
                }

                string val = dtl.GetValByKey(attr.Key).ToString();
                switch (attr.UIContralType)
                {
                case UIContralType.TB:
                    TB tb = new TB();
                    tb.LoadMapAttr(attr);
                    this.ucsys1.AddTD(tb);
                    tb.ID = "TB_" + attr.Key + "_" + dtl.PKVal;
                    switch (attr.MyDataType)
                    {
                    case DataType.AppMoney:
                    case DataType.AppRate:
                        tb.TextExtMoney = decimal.Parse(val);
                        break;

                    default:
                        tb.Text = val;
                        break;
                    }

                    if (attr.IsNum && attr.IsFKorEnum == false)
                    {
                        if (tb.Enabled)
                        {
                            // OnKeyPress="javascript:return VirtyNum(this);"
                            //  tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);";
                            // tb.Attributes["onkeyup"] += "javascript:C" + dtl.PKVal + "();C" + attr.Key + "();";
                            tb.Attributes["class"] = "TBNum";
                        }
                        else
                        {
                            //   tb.Attributes["onpropertychange"] += "C" + attr.Key + "();";
                            tb.Attributes["class"] = "TBNumReadonly";
                        }
                    }
                    break;

                case UIContralType.DDL:
                    if (attr.UIIsReadonly)
                    {
                        ddl = new DDL();
                        ddl.LoadMapAttr(attr);
                        ddl.ID = "DDL_" + attr.Key + "_" + dtl.PKVal;
                        //  this.ucsys1.AddTD(ddl);
                        this.ucsys1.AddTD(ddl);
                        ddl.SetSelectItem(val);
                    }
                    else
                    {
                        this.ucsys1.AddTD(dtl.GetValRefTextByKey(attr.Key));
                    }
                    break;

                case UIContralType.CheckBok:
                    cb    = new CheckBox();
                    cb.ID = "CB_" + attr.Key + "_" + dtl.PKVal;
                    //cb.Text = attr.Name;
                    if (val == "1")
                    {
                        cb.Checked = true;
                    }
                    else
                    {
                        cb.Checked = false;
                    }
                    this.ucsys1.AddTDCenter(cb);
                    break;

                default:
                    break;
                }
            }
            if (map.IsHaveFJ)
            {
                string ext = dtl.GetValStrByKey("MyFileExt");
                if (ext == null || ext.Length > 1)
                {
                    this.ucsys1.AddTD("<a href='" + cfg.FJWebPath + "/" + dtl.PKVal + "." + ext + "' target=_blank ><img src='../Images/FileType/" + dtl.GetValStrByKey("MyFileExt") + ".gif' border=0/>" + dtl.GetValStrByKey("MyFileName") + "</a>");
                }
                else
                {
                    this.ucsys1.AddTD();
                }
            }
            if (uicfg.IsEnableOpenICON)
            {
                this.ucsys1.Add("<TD class='TD' style='cursor:hand;' nowrap=true><a href=" + urlExt + " ><img src='../Img/Btn/Open.gif' border=0/></a></TD>");
            }
            else
            {
                this.ucsys1.AddTD();
            }
            this.ucsys1.AddTREnd();
        }

        #region 生成合计,屏蔽
        //if (false)
        //{
        //    this.ucsys1.AddTRSum();
        //    this.ucsys1.AddTD("colspan=1", "合计");
        //    foreach (Attr attr in attrs)
        //    {
        //        if (attr.UIVisible == false)
        //            continue;

        //        if (attr.IsNum && attr.IsFKorEnum == false)
        //        {
        //            TB tb = new TB();
        //            tb.ID = "TB_" + attr.Key;
        //            tb.Text = attr.DefaultVal.ToString();
        //            tb.ShowType = attr.HisTBType;
        //            tb.ReadOnly = true;
        //            tb.Font.Bold = true;
        //            tb.BackColor = System.Drawing.Color.FromName("#FFFFFF");

        //            switch (attr.MyDataType)
        //            {
        //                case DataType.AppRate:
        //                case DataType.AppMoney:
        //                    tb.TextExtMoney = ens.GetSumDecimalByKey(attr.Key);
        //                    break;
        //                case DataType.AppInt:
        //                    tb.TextExtInt = ens.GetSumIntByKey(attr.Key);
        //                    break;
        //                case DataType.AppFloat:
        //                    tb.TextExtFloat = ens.GetSumFloatByKey(attr.Key);
        //                    break;
        //                default:
        //                    break;
        //            }
        //            this.ucsys1.AddTD(tb);
        //        }
        //        else
        //        {
        //            this.ucsys1.AddTD();
        //        }
        //    }

        //    if (map.IsHaveFJ)
        //        this.ucsys1.AddTD();

        //    this.ucsys1.AddTD();
        //    this.ucsys1.AddTREnd();
        //}
        #endregion 生成合计

        #endregion 生成数据

        this.ucsys1.AddTableEnd();
    }
Ejemplo n.º 16
0
        public override void LoadContent(ContentManager content)
        {
            _managerMap.LoadContent();

            var player = new BaseObject {
                Id = "player"
            };

            player.AddComponent(new Sprite(ManagerContent.LoadTexture("link_full"), 16, 16, new Vector2(50, 50)));
            player.AddComponent(new PlayerInput(ManagerScreen, _managerPlayer));
            player.AddComponent(new Animation(16, 16, 2));
            player.AddComponent(new Collision(_managerMap, _entities));
            player.AddComponent(new Camera(_managerCamera));
            player.AddComponent(new Equipment(content, _managerMap, _managerCamera, _entities));
            player.GetComponent <Equipment>(ComponentType.Equipment).AddItem(new Boomerang(_entities));
            player.GetComponent <Equipment>(ComponentType.Equipment).AddItem(new Sword(_entities));
            player.GetComponent <Equipment>(ComponentType.Equipment).EquipItemInSlot(1, ItemSlot.A);
            player.GetComponent <Equipment>(ComponentType.Equipment).EquipItemInSlot(2, ItemSlot.B);
            player.AddComponent(new Damage(_entities, true));
            player.AddComponent(FactoryStats.GetStats("Link"));
            player.AddComponent(new GUI());
            player.GetComponent <GUI>(ComponentType.GUI).LoadContent(content);


            var testNPC = new BaseObject {
                Hostile = false
            };

            testNPC.AddComponent(new Sprite(ManagerContent.LoadTexture("Marin"), 16, 16, new Vector2(70, 40)));
            //testNPC.AddComponent(new AIMovementRandom(200));
            testNPC.AddComponent(new Animation(16, 16));
            testNPC.AddComponent(new Collision(_managerMap, _entities));
            testNPC.AddComponent(new Camera(_managerCamera));
            //testNPC.AddComponent(new EventTriggerDistance(new List<IGameEvent> { new GameEventMessage("Don't get any closer!")},  new List<BaseObject> { player}, 20, 3000));
            testNPC.AddComponent(new BlockPush(player));
            _entities.AddEntity(testNPC);
            _entities.AddEntity(player);
            //for (int n = 0; n < 1; n++)
            //{
            //    var testEnemy = new BaseObject { Id = string.Format("enemy_{0}", n) };
            //    testEnemy.AddComponent(new Sprite(ManagerContent.LoadTexture("Octorok"), 16, 16, new Vector2(50 + ManagerFunction.Random(10, 20), 50 + ManagerFunction.Random(10, 20))));
            //    testEnemy.AddComponent(new AIMovementRandom(1000));
            //    testEnemy.AddComponent(new Animation(16, 16, 2));
            //    testEnemy.AddComponent(new Collision(_managerMap, _entities));
            //    testEnemy.AddComponent(new Octorok(player, ManagerContent.LoadTexture("Octorok_bullet"), _managerMap, _entities));
            //    testEnemy.AddComponent(new Camera(_managerCamera));
            //    testEnemy.AddComponent(new Damage(_entities));
            //    testEnemy.AddComponent(FactoryStats.GetStats("Octorok"));
            //    testEnemy.AddComponent(new StatusEffect());
            //    _entities.AddEntity(testEnemy);
            //}



            //_entities.AddEntity(testNPC);
            //Script test!
            //var testEnemy = new BaseObject { Id = string.Format("enemy_{0}", "script") };
            //testEnemy.AddComponent(new Sprite(content.Load<Texture2D>("Octorok"), 16, 16, new Vector2(50 + ManagerFunction.Random(10, 20), 50 + ManagerFunction.Random(10, 20))));
            //testEnemy.AddComponent(new AIMovementRandom(1000, 0.5f));
            //testEnemy.AddComponent(new Animation(16, 16, 2));
            //testEnemy.AddComponent(new Collision(_managerMap,_entities));
            //testEnemy.AddComponent(new Octorok(player, content.Load<Texture2D>("Octorok_bullet"), _managerMap,_entities));
            //testEnemy.AddComponent(new Camera(_managerCamera));
            //testEnemy.AddComponent(new Damage(_entities));
            //testEnemy.AddComponent(FactoryStats.GetStats("Octorok"));
            //testEnemy.AddComponent(new Script("script_time_test"));
            //_entities.AddEntity(testEnemy);



            //Just for test
            //var window = new WindowMessage("Hello, this is a message! This is a long message",content);
            //ManagerWindow.NewWindow("test_message",window);
        }
Ejemplo n.º 17
0
        public static int Retrieve(Entities ens, string sql, Paras paras, string[] fullAttrs)
        {
            DataTable dt = null;

            switch (ens.GetNewEntity.EnMap.EnDBUrl.DBUrlType)
            {
            case DBUrlType.AppCenterDSN:
                dt = DBAccess.RunSQLReturnTable(sql, paras);
                break;

            case DBUrlType.DBAccessOfMSMSSQL:
                dt = DBAccessOfMSMSSQL.RunSQLReturnTable(sql);
                break;

            case DBUrlType.DBAccessOfOracle:
                dt = DBAccessOfOracle.RunSQLReturnTable(sql);
                break;

            case DBUrlType.DBAccessOfOLE:
                dt = DBAccessOfOLE.RunSQLReturnTable(sql);
                break;

            default:
                throw new Exception("@没有设置DB类型。");
            }

            if (dt.Rows.Count == 0)
            {
                return(0);
            }

            if (fullAttrs == null)
            {
                Map   enMap = ens.GetNewEntity.EnMap;
                Attrs attrs = enMap.Attrs;
                try
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        Entity en = ens.GetNewEntity;
                        foreach (Attr attr in attrs)
                        {
                            en.Row.SetValByKey(attr.Key, dr[attr.Key]);
                        }
                        ens.AddEntity(en);
                    }
                }
                catch (Exception ex)
                {
                    #warning  应该出现的错误. 2011-12-03 add
                    string cols = "";
                    foreach (DataColumn dc in dt.Columns)
                    {
                        cols += " , " + dc.ColumnName;
                    }
                    throw new Exception("Columns=" + cols + "@Ens=" + ens.ToString() + "@SQL=" + sql + ". @异常信息:" + ex.Message);
                }
            }
            else
            {
                foreach (DataRow dr in dt.Rows)
                {
                    Entity en = ens.GetNewEntity;
                    foreach (string str in fullAttrs)
                    {
                        en.Row.SetValByKey(str, dr[str]);
                    }
                    ens.AddEntity(en);
                }
            }
            int i = dt.Rows.Count;
            dt.Dispose();
            return(i);
            //return dt.Rows.Count;
        }
Ejemplo n.º 18
0
        public void Bind()
        {
            #region 生成标题
            Entity en    = this.HisEn;
            Map    map   = this.HisEn.EnMap;
            Attrs  attrs = map.Attrs;
            bool   isFJ  = false;
            if (attrs.Contains("MyFileName"))
            {
                isFJ = true;
            }

            this.ucsys1.AddTable();
            this.ucsys1.AddTR();
            this.ucsys1.AddTDTitle();

            string str1 = "<INPUT id='checkedAll' onclick='SelectAll(this);' type='checkbox' name='checkedAll'>";
            this.ucsys1.AddTDTitle(str1);
            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                this.ucsys1.AddTDTitle(attr.Desc);
            }
            if (isFJ)
            {
                this.ucsys1.AddTDTitle();
            }

            this.ucsys1.AddTREnd();
            #endregion 生成标题

            this.Page.Title = en.EnDesc;

            Entities    dtls = this.HisEns;
            QueryObject qo   = new QueryObject(dtls);
            qo.AddWhere(this.RefKey, this.RefVal);

            #region 生成翻页
            this.ucsys2.Clear();
            try
            {
                this.ucsys2.BindPageIdx(qo.GetCount(), BP.SystemConfig.PageSize, this.PageIdx, "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.RefVal + "&EnsName=" + this.EnsName + "&RefVal=" + this.RefVal + "&RefKey=" + this.RefKey + "&MainEnsName=" + this.MainEnsName);
                qo.DoQuery(en.PK, this.PageSize, this.PageIdx, false);
            }
            catch
            {
                dtls.GetNewEntity.CheckPhysicsTable();
                //   this.Response.Redirect("Ens.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal, true);
                return;
            }
            #endregion 生成翻页
            UAC uac = en.HisUAC;
            if (uac.IsDelete == false)
            {
                this.ToolBar1.GetBtnByID(NamesOfBtn.Delete).Enabled = false;
            }

            if (uac.IsInsert)
            {
                en.PKVal = "0";
                dtls.AddEntity(en);
            }

            DDL      ddl = new DDL();
            CheckBox cb  = new CheckBox();
            bool     is1 = false;

            #region 生成数据
            int i = 0;
            foreach (Entity dtl in dtls)
            {
                i++;
                if (dtl.PKVal == "0" || dtl.PKVal == "")
                {
                    this.ucsys1.AddTRSum();
                    this.ucsys1.AddTD("colspan=2", "<b>*</B>");
                }
                else
                {
                    //  is1 = this.ucsys1.AddTR(is1, "ondblclick=\"WinOpen( 'UIEn.aspx?EnsName=" + this.EnsName + "&PK=" + dtl.PKVal + "', 'cd' )\"");
                    is1 = this.ucsys1.AddTR(is1);

                    //  is1 = this.ucsys1.AddTR(is1);
                    this.ucsys1.AddTDIdx(i);
                    cb    = new CheckBox();
                    cb.ID = "CB_" + dtl.PKVal;
                    this.ucsys1.AddTD(cb);
                }

                foreach (Attr attr in attrs)
                {
                    if (attr.UIVisible == false)
                    {
                        continue;
                    }

                    if (attr.Key == "OID")
                    {
                        continue;
                    }

                    string val = dtl.GetValByKey(attr.Key).ToString();
                    switch (attr.UIContralType)
                    {
                    case UIContralType.TB:
                        TB tb = new TB();
                        this.ucsys1.AddTD(tb);
                        tb.LoadMapAttr(attr);
                        tb.ID = "TB_" + attr.Key + "_" + dtl.PKVal;
                        tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border-width:0px;";
                        switch (attr.MyDataType)
                        {
                        case DataType.AppMoney:
                        case DataType.AppRate:
                            tb.TextExtMoney = decimal.Parse(val);
                            break;

                        case DataType.AppDate:
                            tb.Text     = val.ToString();
                            tb.ShowType = TBType.Date;
                            if (attr.UIIsReadonly == false)
                            {
                                tb.Attributes["onfocus"] = "WdatePicker();";
                            }
                            break;

                        case DataType.AppDateTime:
                            tb.Text     = val.ToString();
                            tb.ShowType = TBType.DateTime;
                            if (attr.UIIsReadonly == false)
                            {
                                tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});";
                            }
                            break;

                        default:
                            tb.Text = val;
                            break;
                        }

                        if (attr.IsNum && attr.IsFKorEnum == false)
                        {
                            if (tb.Enabled)
                            {
                                // OnKeyPress="javascript:return VirtyNum(this);"
                                //  tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);";
                                // tb.Attributes["onkeyup"] += "javascript:C" + dtl.PKVal + "();C" + attr.Key + "();";
                                tb.Attributes["class"] = "TBNum";
                            }
                            else
                            {
                                //   tb.Attributes["onpropertychange"] += "C" + attr.Key + "();";
                                tb.Attributes["class"] = "TBNumReadonly";
                            }
                        }
                        break;

                    case UIContralType.DDL:
                        ddl    = new DDL();
                        ddl.ID = "DDL_" + attr.Key + "_" + dtl.PKVal;
                        if (attr.UIIsReadonly == false)
                        {
                            ddl.Items.Add(new ListItem(dtl.GetValRefTextByKey(attr.Key), val));
                            ddl.Enabled = false;
                        }
                        else
                        {
                            if (attr.IsEnum)
                            {
                                ddl.BindSysEnum(attr.UIBindKey);
                            }
                            else
                            {
                                ddl.BindEntities(attr.HisFKEns, attr.UIRefKeyValue, attr.UIRefKeyText);
                            }
                        }
                        this.ucsys1.AddTD(ddl);
                        ddl.SetSelectItem(val);
                        break;

                    case UIContralType.CheckBok:
                        cb      = new CheckBox();
                        cb.ID   = "CB_" + attr.Key + "_" + dtl.PKVal;
                        cb.Text = attr.Desc;
                        if (val == "1")
                        {
                            cb.Checked = true;
                        }
                        else
                        {
                            cb.Checked = false;
                        }
                        this.ucsys1.AddTD("nowarp=true", cb);
                        break;

                    default:
                        break;
                    }
                }

                if (isFJ)
                {
                    string ext = dtl.GetValStrByKey("MyFileExt");
                    if (ext != "")
                    {
                        this.ucsys1.AddTD("<img src='../Images/FileType/" + ext + ".gif' border=0/>" + dtl.GetValStrByKey("MyFileName"));
                    }
                }
                this.ucsys1.AddTREnd();
            }
            #region 生成合计
            //this.ucsys1.AddTRSum();
            //this.ucsys1.AddTD("colspan=2", "合计");
            //foreach (Attr attr in attrs)
            //{
            //    if (attr.UIVisible == false)
            //        continue;
            //    if (attr.IsNum && attr.IsFKorEnum == false)
            //    {
            //        TB tb = new TB();
            //        tb.ID = "TB_" + attr.Key;
            //        tb.Text = attr.DefaultVal.ToString();
            //        tb.ShowType = attr.HisTBType;
            //        tb.ReadOnly = true;
            //        tb.Font.Bold = true;
            //        tb.BackColor = System.Drawing.Color.FromName("infobackground");

            //        switch (attr.MyDataType)
            //        {
            //            case DataType.AppRate:
            //            case DataType.AppMoney:
            //                tb.TextExtMoney = dtls.GetSumDecimalByKey(attr.Key);
            //                break;
            //            case DataType.AppInt:
            //                tb.TextExtInt = dtls.GetSumIntByKey(attr.Key);
            //                break;
            //            case DataType.AppFloat:
            //                tb.TextExtFloat = dtls.GetSumFloatByKey(attr.Key);
            //                break;
            //            default:
            //                break;
            //        }
            //        this.ucsys1.AddTD(tb);
            //    }
            //    else
            //    {
            //        this.ucsys1.AddTD();
            //    }
            //}
            //this.ucsys1.AddTD();
            //this.ucsys1.AddTREnd();
            #endregion 生成合计

            #endregion 生成数据
            this.ucsys1.AddTableEnd();
        }