Exemplo n.º 1
0
        protected override void DrawModel(Player p)
        {
            int texId = p.PlayerTextureId <= 0 ? cache.HumanoidTexId : p.PlayerTextureId;

            graphics.BindTexture(texId);
            graphics.AlphaTest = false;

            SkinType skinType = p.SkinType;

            _64x64 = skinType != SkinType.Type64x32;
            ModelSet model = skinType == SkinType.Type64x64Slim ? SetSlim : Set;

            DrawHeadRotate(0, 24 / 16f, 0, -p.PitchRadians, 0, 0, model.Head);

            DrawPart(model.Torso);
            DrawRotate(0, 12 / 16f, 0, p.anim.legXRot, 0, 0, model.LeftLeg);
            DrawRotate(0, 12 / 16f, 0, -p.anim.legXRot, 0, 0, model.RightLeg);
            Rotate = RotateOrder.XZY;
            DrawRotate(-5 / 16f, 22 / 16f, 0, p.anim.leftXRot, 0, p.anim.leftZRot, model.LeftArm);
            DrawRotate(5 / 16f, 22 / 16f, 0, p.anim.rightXRot, 0, p.anim.rightZRot, model.RightArm);
            Rotate = RotateOrder.ZYX;
            graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4);

            graphics.AlphaTest = true;
            index = 0;
            DrawHeadRotate(0, 24f / 16f, 0, -p.PitchRadians, 0, 0, model.Hat);
            graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, cache.vb, cache.vertices, index, index * 6 / 4);
        }
Exemplo n.º 2
0
 private void HandleGetModels(ModelSet result, Dictionary <string, object> customData)
 {
     Log.Debug("ExampleSpeechToText.HandleGetModels()", "{0}", customData["json"].ToString());
     _modelNameToGet = (result.models[UnityEngine.Random.Range(0, result.models.Length - 1)] as Model).name;
     Test(result != null);
     _getModelsTested = true;
 }
Exemplo n.º 3
0
        public byte[] Write()
        {
            MemoryStream       m  = new MemoryStream();
            EndianBinaryWriter er = new EndianBinaryWriter(m, Endianness.LittleEndian);

            Header.NrBlocks = (ushort)(TexPlttSet != null ? 2 : 1);
            Header.Write(er);

            long curpos = er.BaseStream.Position;

            er.BaseStream.Position = 16;
            er.Write((UInt32)curpos);
            er.BaseStream.Position = curpos;

            ModelSet.Write(er);
            if (TexPlttSet != null)
            {
                curpos = er.BaseStream.Position;
                er.BaseStream.Position = 20;
                er.Write((UInt32)curpos);
                er.BaseStream.Position = curpos;

                TexPlttSet.Write(er);
            }
            er.BaseStream.Position = 8;
            er.Write((UInt32)er.BaseStream.Length);
            byte[] b = m.ToArray();
            er.Close();
            return(b);
        }
Exemplo n.º 4
0
 /// <inheritdoc />
 public async Task <bool> TryCreateAsync(TModelType model)
 {
     //TODO: Should we validate no key already exists?
     ModelSet.Add(model);
     return(await SaveAndCheckResultsAsync()
            .ConfigureAwaitFalse());
 }
Exemplo n.º 5
0
        protected override void RenderParts(Entity p)
        {
            HumanoidModel human = (HumanoidModel)game.ModelCache.Models[0].Instance;

            vertices = human.vertices;
            // If user changes option while game is running
            if (classicArms != game.ClassicArmModel)
            {
                classicArms = game.ClassicArmModel;
                SetTranslationMatrix();
            }

            SkinType skinType = p.SkinType;
            ModelSet model    = skinType == SkinType.Type64x64Slim ? human.SetSlim :
                                (skinType == SkinType.Type64x64 ? human.Set64 : human.Set);

            game.Graphics.PushMatrix();
            game.Graphics.MultiplyMatrix(ref m);
            Rotate = RotateOrder.YZX;

            DrawArmPart(model.RightArm);
            UpdateVB();
            if (skinType != SkinType.Type64x32)
            {
                index = 0;
                game.Graphics.AlphaTest = true;
                DrawArmPart(model.RightArmLayer);
                UpdateVB();
                game.Graphics.AlphaTest = false;
            }

            Rotate = RotateOrder.ZYX;
            game.Graphics.PopMatrix();
        }
Exemplo n.º 6
0
        protected virtual void RenderParts(Entity p)
        {
            SkinType skinType = p.SkinType;
            ModelSet model    = skinType == SkinType.Type64x64Slim ? SetSlim :
                                (skinType == SkinType.Type64x64 ? Set64 : Set);

            DrawRotate(-p.HeadXRadians, 0, 0, model.Head, true);
            DrawPart(model.Torso);

            DrawRotate(p.anim.leftLegX, 0, p.anim.leftLegZ, model.LeftLeg, false);
            DrawRotate(p.anim.rightLegX, 0, p.anim.rightLegZ, model.RightLeg, false);
            Rotate = RotateOrder.XZY;
            DrawRotate(p.anim.leftArmX, 0, p.anim.leftArmZ, model.LeftArm, false);
            DrawRotate(p.anim.rightArmX, 0, p.anim.rightArmZ, model.RightArm, false);
            Rotate = RotateOrder.ZYX;
            UpdateVB();

            game.Graphics.AlphaTest = true;
            index = 0;
            if (skinType != SkinType.Type64x32)
            {
                DrawPart(model.TorsoLayer);
                DrawRotate(p.anim.leftLegX, 0, p.anim.leftLegZ, model.LeftLegLayer, false);
                DrawRotate(p.anim.rightLegX, 0, p.anim.rightLegZ, model.RightLegLayer, false);
                Rotate = RotateOrder.XZY;
                DrawRotate(p.anim.leftArmX, 0, p.anim.leftArmZ, model.LeftArmLayer, false);
                DrawRotate(p.anim.rightArmX, 0, p.anim.rightArmZ, model.RightArmLayer, false);
                Rotate = RotateOrder.ZYX;
            }
            DrawRotate(-p.HeadXRadians, 0, 0, model.Hat, true);
            UpdateVB();
        }
Exemplo n.º 7
0
        /// <inheritdoc />
        public async Task <DBRPGGroup> RemoveMemberAsync(int characterId, CancellationToken token = default)
        {
            //If there is only one member then we should disband the group
            //But we NEED TO KNOW that the group was disbanded for future proof realtime social notifications
            //involving group listing and possibily other stuff.
            var groupMember = await Context.Set <DBRPGGroupMember>()
                              .Include(gm => gm.Group)
                              .ThenInclude(g => g.Members)
                              .FirstAsync(gm => gm.CharacterId == characterId, token);

            groupMember.Group
            .Members
            .Remove(groupMember);

            //Group is empty, let's disband it.
            if (!groupMember.Group.Members.Any())
            {
                ModelSet.Remove(groupMember.Group);
            }

            await Context.SaveChangesAsync(true, token);

            //Caller will be able to see group state now, especially helpful if the group is empty or disbanded.
            return(groupMember.Group);
        }
Exemplo n.º 8
0
        void view_LoadFile(object sender, EventArgs e)
        {
            TreeNode node = sender as TreeNode;
            FileInfo file = node.Tag as FileInfo;

            if (file == null)
            {
                return;
            }
            if (file.Extension == ".csv")
            {
                System.Diagnostics.Process.Start("notepad.exe", file.FullName);
                return;
            }
            if (file.Extension != ".bit")
            {
                try
                {
                    System.Diagnostics.Process.Start(file.FullName);
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
                return;
            }
            ModelSet model = new ModelSet(new FileActionRepository(file.FullName));

            Context.ActionModel = model;

            Context.State.DataPrepared = true;
        }
Exemplo n.º 9
0
        public PlayerModel( Game window )
            : base(window)
        {
            vertices = new ModelVertex[boxVertices * ( 7 + 2 )];
            Set = new ModelSet();

            Set.Head = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                                .SetTexOrigin( 0, 0 ) );
            Set.Torso = BuildBox( MakeBoxBounds( -4, 12, -2, 4, 24, 2 )
                                 .SetTexOrigin( 16, 16 ) );
            Set.LeftLeg = BuildBox( MakeBoxBounds( 0, 0, -2, -4, 12, 2 )
                                   .SetTexOrigin( 0, 16 ) );
            Set.RightLeg = BuildBox( MakeBoxBounds( 0, 0, -2, 4, 12, 2 ).
                                    SetTexOrigin( 0, 16 ) );
            Set.Hat = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                               .SetTexOrigin( 32, 0 )
                               .SetModelBounds( -4.5f, 23.5f, -4.5f, 4.5f, 32.5f, 4.5f ) );
            Set.LeftArm = BuildBox( MakeBoxBounds( -4, 12, -2, -8, 24, 2 )
                                   .SetTexOrigin( 40, 16 ) );
            Set.RightArm = BuildBox( MakeBoxBounds( 4, 12, -2, 8, 24, 2 )
                                    .SetTexOrigin( 40, 16 ) );

            SetSlim = new ModelSet();
            SetSlim.Head = Set.Head;
            SetSlim.Torso = Set.Torso;
            SetSlim.LeftLeg = Set.LeftLeg;
            SetSlim.RightLeg = Set.RightLeg;
            SetSlim.LeftArm = BuildBox( MakeBoxBounds( -7, 12, -2, -4, 24, 2 )
                                       .SetTexOrigin( 32, 48 ) );
            SetSlim.RightArm = BuildBox( MakeBoxBounds( 4, 12, -2, 7, 24, 2 )
                                        .SetTexOrigin( 40, 16 ) );
            SetSlim.Hat = Set.Hat;
        }
Exemplo n.º 10
0
 private void HandleGetModels(ModelSet result, string customData)
 {
     Log.Debug("ExampleSpeechToText", "Speech to Text - Get models response: {0}", customData);
     _modelNameToGet = (result.models[UnityEngine.Random.Range(0, result.models.Length - 1)] as Model).name;
     Test(result != null);
     _getModelsTested = true;
 }
Exemplo n.º 11
0
        public HumanoidModel(Game window) : base(window)
        {
            vertices = new ModelVertex[boxVertices * (7 + 2)];
            Set      = new ModelSet();

            Set.Head = BuildBox(MakeBoxBounds(-4, 24, -4, 4, 32, 4)
                                .SetTexOrigin(0, 0));
            Set.Torso = BuildBox(MakeBoxBounds(-4, 12, -2, 4, 24, 2)
                                 .SetTexOrigin(16, 16));
            Set.LeftLeg = BuildBox(MakeBoxBounds(0, 0, -2, -4, 12, 2)
                                   .SetTexOrigin(0, 16));
            Set.RightLeg = BuildBox(MakeBoxBounds(0, 0, -2, 4, 12, 2).
                                    SetTexOrigin(0, 16));
            Set.Hat = BuildBox(MakeBoxBounds(-4, 24, -4, 4, 32, 4)
                               .SetTexOrigin(32, 0).ExpandBounds(0.5f));
            Set.LeftArm = BuildBox(MakeBoxBounds(-4, 12, -2, -8, 24, 2)
                                   .SetTexOrigin(40, 16));
            Set.RightArm = BuildBox(MakeBoxBounds(4, 12, -2, 8, 24, 2)
                                    .SetTexOrigin(40, 16));

            SetSlim          = new ModelSet();
            SetSlim.Head     = Set.Head;
            SetSlim.Torso    = Set.Torso;
            SetSlim.LeftLeg  = Set.LeftLeg;
            SetSlim.RightLeg = Set.RightLeg;
            SetSlim.LeftArm  = BuildBox(MakeBoxBounds(-7, 12, -2, -4, 24, 2)
                                        .SetTexOrigin(32, 48));
            SetSlim.RightArm = BuildBox(MakeBoxBounds(4, 12, -2, 7, 24, 2)
                                        .SetTexOrigin(40, 16));
            SetSlim.Hat = Set.Hat;
        }
 /// <inheritdoc />
 public override async Task <TConfigurationModelType> RetrieveAsync(GameConfigurationKey <TConfigType> key, CancellationToken token = default, bool includeNavigationProperties = false)
 {
     if (key == null)
     {
         throw new ArgumentNullException(nameof(key));
     }
     return(await ModelSet.FindAsync(new object[] { key.Id, key.Config }, token));
 }
Exemplo n.º 13
0
        /// <inheritdoc />
        public override Task <PathWaypointModel> RetrieveAsync(PathWaypointKey key, bool includeNavigationProperties = false)
        {
            if (includeNavigationProperties)
            {
                throw new NotImplementedException($"TODO: Add support for nav properties for {nameof(PathWaypointModel)}");
            }

            return(ModelSet.FindAsync(key.PathId, key.PointId));
        }
Exemplo n.º 14
0
        void view_New(object sender, EventArgs e)
        {
            NewFileEventArgs args  = e as NewFileEventArgs;
            ModelSet         model = new ModelSet(new FileActionRepository());

            Context.ActionModel = model;
            model.New(args.ProjectName, args.StartUrl, args.Method);
            Context.State.DataPrepared = true;
            Context.State.IsRecord     = true;
        }
Exemplo n.º 15
0
 void Browser_BeforeNavigate2(object sender, csExWB.BeforeNavigate2EventArgs e)
 {
     //内置协议,打开在线脚本
     if (e.url.IndexOf("autorobo://") == 0)
     {
         e.Cancel = true;
         ProtocolObject   protocol   = ProtocolObject.DeserializeObject(e.url);
         ActionRepository repository = new ActionRepository((RecorderProtocol)protocol);
         var model = new ModelSet(repository);
     }
 }
Exemplo n.º 16
0
    // Initialize all site elements (data sets) that were provided in the JSON data.
    public void InitializeSiteElements()
    {
        // Create a new list of data sets.
        dataSets = new List <SiteElementSet>();

        // If there are panos, load the panos.
        if (siteData.panos != null && siteData.panos.Length > 0)
        {
            // Create a new set object, which contains data elements.
            GameObject panoSetObj = CreateElementSetObject(PanoSet.elementString);

            // Add the "PanoSet" to this new object, to show it's a set of panoramas.
            PanoSet panoSet = panoSetObj.AddComponent <PanoSet>();

            // Initialize the pano set.
            panoSet.Initialize(siteData.panos, this);

            // Add the pano set to the list of data sets on this site.
            dataSets.Add(panoSet);
        }

        // If there are models, load the models.
        if (siteData.models != null && siteData.models.Length > 0)
        {
            // Create a new object for this data set.
            GameObject modelSetObj = CreateElementSetObject(ModelSet.elementString);

            // Add the model set script to that object.
            ModelSet modelSet = modelSetObj.AddComponent <ModelSet>();

            // Initialize the model set, which will initialize all it's models.
            modelSet.Initialize(siteData.models, this);

            // Add the models to the list of data sets here.
            dataSets.Add(modelSet);
        }

        /*
         * if(siteData.points != null && siteData.points.Length > 0){
         *   // Create a new object for this data set.
         *   GameObject pointsSetObj = CreateElementSetObject(PointsOOCSet.elementString);
         *
         *   // Add the points set script to that object.
         *   PointsOOCSet pointsSet = pointsSetObj.AddComponent<PointsOOCSet>();
         *
         *   // Initialize the points set, which will initialize all it's points.
         *   pointsSet.Initialize(siteData.points, this);
         *
         *   // Add the points to the list of data sets here.
         *   dataSets.Add(pointsSet);
         * }
         */
        // TODO: More supported data types.
    }
Exemplo n.º 17
0
        private void CreateRootDictionaries()
        {
            for (int i = 0; i < Models.Length; i++)
            {
                Models[i] = new ModelSet();
            }

            for (int i = 0; i < Voxels.Length; i++)
            {
                Voxels[i] = new VoxelSet();
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 发布信息
        /// </summary>
        /// <param name="schemaId"></param>
        /// <param name="scriptId"></param>
        /// <param name="schemaObjectId"></param>
        private void Publish(string schemaId, string scriptId, string schemaObjectId)
        {
            browser.WBLButtonDown -= new csExWB.HTMLMouseEventHandler(webBrowser_WBLButtonDown);
            browser.WBLButtonDown += new csExWB.HTMLMouseEventHandler(webBrowser_WBLButtonDown);

            ThreadRepository rep = new ThreadRepository(schemaId, scriptId, schemaObjectId);
            var model            = new ModelSet(rep);

            var currentWorker = new ActionRunnable(model);

            currentWorker.Run(WaitComplete, true);
        }
Exemplo n.º 19
0
        private void CreateRootDictionaries()
        {
            for (int i = 0; i < Models.Length; i++)
            {
                Models[i] = new ModelSet();
            }

            for (int i = 0; i < Voxels.Length; i++)
            {
                Voxels[i] = new VoxelSet();
            }
        }
Exemplo n.º 20
0
        public override void DrawModel(Entity p)
        {
            ModelSet model = p.SkinType == SkinType.Type64x64Slim ? SetSlim : (p.SkinType == SkinType.Type64x64 ? Set64 : Set);

            float flyRot = p.anim.swing * (float)Math.PI / -2.0f;
            float legRot = (float)(Math.Cos(p.anim.walkTime / 8f) + 1f) * p.anim.swing * (float)Math.PI / 64f;
            float armRot = (float)(Math.Sin(p.anim.walkTime / 8f) + 1f) * p.anim.swing * (float)Math.PI / 32f;
            float headRot;

            if (p.HeadXRadians > (float)Math.PI / 2f && flyRot != 0f)
            {
                headRot = ((float)Math.PI * 2f - p.HeadXRadians) * (1f - p.anim.swing);
            }
            else
            {
                headRot = -p.HeadXRadians;
            }

            Rotate = RotateOrder.XZY;

            game.Graphics.BindTexture(GetTexture(p));
            game.Graphics.AlphaTest = false;

            DrawRotate(headRot, 0f, 0f, model.Head, true);

            DrawRotate(flyRot, 0f, 0f, model.Torso, false);
            //DrawRotate(-flyRot, -legRot / 8f, p.anim.leftArmZ / 4f + p.anim.swing / 32f, model.LeftLeg, false);
            //DrawRotate(-flyRot, legRot / 8f, p.anim.rightArmZ / 4f - p.anim.swing / 32f, model.RightLeg, false);
            DrawRotate(flyRot, -armRot, p.anim.leftArmZ * (1f - p.anim.swing), model.LeftArm, false);
            DrawRotate(-flyRot, armRot - (float)Math.PI * 3f / 64f, p.anim.rightArmZ * (1f - p.anim.swing), model.RightArm, false);

            DrawTranslateAndRotate(0f, (float)Math.Cos(flyRot) * -12f / 16f + 12f / 16f, (float)Math.Sin(flyRot) * -12f / 16f, flyRot, -legRot, p.anim.leftArmZ * (1f - p.anim.swing), model.LeftLeg);
            DrawTranslateAndRotate(0f, (float)Math.Cos(flyRot) * -12f / 16f + 12f / 16f, (float)Math.Sin(flyRot) * -12f / 16f, flyRot, legRot, p.anim.rightArmZ * (1f - p.anim.swing), model.RightLeg);

            UpdateVB();

            game.Graphics.AlphaTest = true;
            index = 0;

            if (p.SkinType != SkinType.Type64x32)
            {
                DrawRotate(flyRot, 0f, 0f, model.TorsoLayer, false);
                //DrawRotate(flyRot, -legRot / 8f, p.anim.leftArmZ / 4f + p.anim.swing / 32f, model.LeftLegLayer, false);
                //DrawRotate(flyRot, legRot / 8f, p.anim.rightArmZ / 4f + p.anim.swing / 32f, model.RightLegLayer, false);
                DrawTranslateAndRotate(0f, (float)Math.Cos(flyRot) * -12f / 16f + 12f / 16f, (float)Math.Sin(flyRot) * -12f / 16f, flyRot, -legRot, p.anim.leftArmZ * (1f - p.anim.swing), model.LeftLegLayer);
                DrawTranslateAndRotate(0f, (float)Math.Cos(flyRot) * -12f / 16f + 12f / 16f, (float)Math.Sin(flyRot) * -12f / 16f, flyRot, legRot, p.anim.rightArmZ * (1f - p.anim.swing), model.RightLegLayer);
                DrawRotate(flyRot, -armRot, p.anim.leftArmZ, model.LeftArmLayer, false);
                DrawRotate(-flyRot, armRot - (float)Math.PI * 3f / 64f, p.anim.rightArmZ, model.RightArmLayer, false);
            }
            DrawRotate(headRot, 0f, 0f, model.Hat, true);

            UpdateVB();
        }
Exemplo n.º 21
0
        public override void DrawModel(Entity p)
        {
            ModelSet model = p.SkinType == SkinType.Type64x64Slim ? SetSlim : (p.SkinType == SkinType.Type64x64 ? Set64 : Set);

            Rotate = RotateOrder.XZY;

            float handBob  = (float)Math.Sin(p.anim.walkTime * 2f) * p.anim.swing * (float)Math.PI / 16f;
            float handIdle = p.anim.rightArmX * (1f - p.anim.swing);

            game.Graphics.BindTexture(GetTexture(p));
            game.Graphics.AlphaTest = false;

            DrawPart(model.Torso);

            DrawRotate(-p.HeadXRadians, 0f, 0f, model.Head, true);

            DrawRotate(p.anim.leftLegX, 0f, p.anim.leftLegZ, model.LeftLeg, false);
            DrawRotate(p.anim.rightLegX, 0f, p.anim.rightLegZ, model.RightLeg, false);
            DrawRotate((float)Math.PI / 3f + handBob + handIdle, (handBob + handIdle) * -2f / 3f, (float)Math.PI / 8f, model.LeftArm, false);
            DrawRotate((float)Math.PI / 3f + handBob + handIdle, (handBob + handIdle) * 2f / 3f, (float)Math.PI / -8f, model.RightArm, false);

            UpdateVB();

            game.Graphics.AlphaTest = true;
            index = 0;

            if (p.SkinType != SkinType.Type64x32)
            {
                DrawPart(model.TorsoLayer);

                DrawRotate(p.anim.leftLegX, 0f, p.anim.leftLegZ, model.LeftLegLayer, false);
                DrawRotate(p.anim.rightLegX, 0f, p.anim.rightLegZ, model.RightLegLayer, false);
                DrawRotate((float)Math.PI / 3f + handBob + handIdle, (handBob + handIdle) * -2f / 3f, (float)Math.PI / 8f, model.LeftArmLayer, false);
                DrawRotate((float)Math.PI / 3f + handBob + handIdle, (handBob + handIdle) * 2f / 3f, (float)Math.PI / -8f, model.RightArmLayer, false);
            }
            DrawRotate(-p.HeadXRadians, 0f, 0f, model.Hat, true);

            UpdateVB();
            index = 0;

            if (BlockInfo.Draw[p.ModelBlock] != DrawType.Gas)
            {
                if (BlockInfo.FullBright[p.ModelBlock])
                {
                    for (int i = 0; i < cols.Length; i++)
                    {
                        cols[i] = PackedCol.White;
                    }
                }
                DrawBlockTransform(p, 0f, ((float)Math.PI / 3f + handBob + handIdle) * 10f / 16f + 8f / 16f, -9f / 16f, 0.5f);
            }
        }
Exemplo n.º 22
0
        private void Write(List <IHTMLElement> activeElements)
        {
            if (activeElements.Count == 0)
            {
                return;
            }
            IAppContext context = AppContext.Current;
            ModelSet    model   = new ModelSet(new CustomScriptWriteRepository(Identity.UserId, scriptId));

            foreach (var o in activeElements)
            {
                var type = ActionElementBase.TagStringToElementType(o);
                switch (type)
                {
                case ElementTypes.TextField:
                    model.AddAction(context, ActionEnum.ActionTypeText.ToString(),
                                    new ActionTypingParameter()
                    {
                        Element     = o,
                        XPathFinder = false
                    });
                    break;

                case ElementTypes.RadioButton:
                    model.AddAction(context, ActionEnum.ActionRadio.ToString(), new ActionClickParameter()
                    {
                        Element = o,
                    });
                    break;

                case ElementTypes.CheckBox:
                    model.AddAction(context, ActionEnum.ActionCheckbox.ToString(), new ActionClickParameter()
                    {
                        Element = o,
                    });
                    break;

                case ElementTypes.SelectList:
                    model.AddAction(context, ActionEnum.ActionSelectList.ToString(),
                                    new Core.ActionBuilder.SelectParameter()
                    {
                        ByValue = true, Element = o
                    });
                    break;

                default:
                    break;
                }
            }
            activeElements.Clear();
            model.Save();
        }
Exemplo n.º 23
0
        private void AddActions()
        {
            BrowserWindow watinie = Action.Window;
            ModelSet      wscript = Action.AppContext.ActionModel;

            foreach (GridRow o in gridElement.Rows)
            {
                var element = o.Tag as IHTMLElement;
                if (element == null)
                {
                    continue;
                }
                var val = element.getAttribute("value", 0);
                if (element.tagName == "SELECT")
                {
                    //wscript.AddClick(watinie, element);
                    wscript.AddAction(Action.AppContext, ActionEnum.ActionClick.ToString(), new ActionClickParameter()
                    {
                        Element = element,
                    });
                    wscript.AddAction(Action.AppContext, ActionEnum.ActionSelectList.ToString(),
                                      new Core.ActionBuilder.SelectParameter()
                    {
                        ByValue = (val != null), Element = element
                    });
                }
                else if (element.tagName == "INPUT")
                {
                    var type = element.getAttribute("type", 0).ToString().ToLower();
                    if (type == "checkbox" || type == "radio")
                    {
                        // wscript.AddClick(watinie, element, true);
                        wscript.AddAction(Action.AppContext, ActionEnum.ActionClick.ToString(), new ActionClickParameter()
                        {
                            Element = element,
                        });
                    }
                    else
                    {
                        //wscript.SbKeys = new StringBuilder(val == null ? "" : val.ToString());
                        //wscript.AddTyping(watinie, element, false, true);
                        wscript.AddAction(Action.AppContext, ActionEnum.ActionTypeText.ToString(),
                                          new ActionTypingParameter()
                        {
                            Element     = element,
                            XPathFinder = false,
                            SbKeys      = (val == null ? "" : val.ToString())
                        });
                    }
                }
            }
        }
        /// <inheritdoc />
        public async Task UpdateAsync(TKey key, TModelType model, CancellationToken token = default)
        {
            if (!await ContainsAsync(key, token))
            {
                throw new InvalidOperationException($"Cannot update model with Key: {key} as it does not exist.");
            }

            //TODO: is this slow? Is there a better way to deal with tracked entities?
            Context.Entry(await RetrieveAsync(key, token)).State = EntityState.Detached;
            ModelSet.Update(model);

            await SaveAndCheckResultsAsync(token);
        }
Exemplo n.º 25
0
        public override void DrawArm(Entity p)
        {
            SkinType skin  = IModel.skinType;
            ModelSet model = skin == SkinType.Type64x64Slim ? SetSlim :
                             (skin == SkinType.Type64x64 ? Set64 : Set);

            DrawArmPart(model.RightArm);
            if (skin != SkinType.Type64x32)
            {
                DrawArmPart(model.RightArmLayer);
            }
            UpdateVB();
        }
Exemplo n.º 26
0
        public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
        {
            string url    = string.Format(ServerApiInvoker.Domain + "tasks/GetLoginScriptByEmail?email={0}", Identity.MockUser.Email);
            string script = HttpRequestWapper.GetData(url, Identity.Ticket);

            var model = new ModelSet(new LocalScriptRepository(script));

            var currentWorker = new ActionRunnable(model);

            currentWorker.Run(null, true);

            return(new EmptyResult());
        }
Exemplo n.º 27
0
 public override async Task <DBRPGGroup> RetrieveAsync(int key, CancellationToken token = default, bool includeNavigationProperties = false)
 {
     if (includeNavigationProperties)
     {
         return(await ModelSet
                .Include(g => g.Members)
                .FirstAsync(g => g.Id == key, token));
     }
     else
     {
         return(await ModelSet.FindAsync(new object[] { key }, token));
     }
 }
Exemplo n.º 28
0
        /// <summary>
        /// 执行用户手动调整的脚本
        /// </summary>
        /// <param name="result"></param>
        private void WaitComplete(AsyncResult result)
        {
            browser.WBLButtonDown -= new csExWB.HTMLMouseEventHandler(webBrowser_WBLButtonDown);
            string customScript = ServerApiInvoker.Get_record_mark(Identity.UserId, scriptId);

            if (!string.IsNullOrEmpty(customScript) && customScript.Length > 10)
            {
                LocalScriptRepository rep = new LocalScriptRepository(customScript);
                var model = new ModelSet(rep);

                var currentWorker = new ActionRunnable(model);
                currentWorker.Run(null, true);
            }
        }
Exemplo n.º 29
0
        public void IeTest()
        {
            AppSettings.Instance.Debug = true;
            string fileName = @"D:\bitrun\上市公司财务报表\script\提取上市公司3大报表数据.bit";

            AppContext.Current.Browser = new MyIE();
            //构造脚本模型
            var model = new ModelSet(new FileActionRepository(fileName));

            var work = new ActionRunnable(AppContext.Current.ActionModel);

            AppContext.Current.CurrentWorker = work;
            work.Run(null, true);
        }
        /// <inheritdoc />
        public async Task <bool> TryDeleteAsync(TKey key, CancellationToken token = default)
        {
            //If it doesn't exist then this will just fail, so get out soon.
            if (!await ContainsAsync(key, token))
            {
                return(false);
            }

            TModelType modelType = await RetrieveAsync(key, token);

            ModelSet.Remove(modelType);

            return(await SaveAndCheckResultsAsync(token));
        }
Exemplo n.º 31
0
        /// <inheritdoc />
        public async Task <bool> TryDeleteAsync(TKey key)
        {
            //If it doesn't exist then this will just fail, so get out soon.
            if (!await ContainsAsync(key).ConfigureAwaitFalse())
            {
                return(false);
            }

            TModelType modelType = await RetrieveAsync(key)
                                   .ConfigureAwaitFalse();

            ModelSet.Remove(modelType);

            return(await SaveAndCheckResultsAsync()
                   .ConfigureAwaitFalse());
        }
Exemplo n.º 32
0
        void view_Open(object sender, EventArgs e)
        {
            OpenFileDialog fDialog = new OpenFileDialog();

            fDialog.Title            = "打开工程文件";
            fDialog.Filter           = "BIT Files|*.bit";
            fDialog.InitialDirectory = AppSettings.Instance.LibraryPath;
            if (fDialog.ShowDialog() == DialogResult.OK)
            {
                ModelSet model = new ModelSet(new FileActionRepository(fDialog.FileName));
                Context.ActionModel = model;

                Context.State.DataPrepared = true;
            }
            Context.State.IsRecord = false;
        }
Exemplo n.º 33
0
        internal override void CreateParts()
        {
            vertices = new ModelVertex[boxVertices * (7 + 7 + 4)];
            Set = new ModelSet();
            MakeDescriptions();

            Set.Head = BuildBox( head.TexOrigin( 0, 0 ) );
            Set.Torso = BuildBox( torso.TexOrigin( 16, 16 ) );
            Set.LeftLeg = BuildBox( lLeg.MirrorX().TexOrigin( 0, 16 ) );
            Set.RightLeg = BuildBox( rLeg.TexOrigin( 0, 16 ) );
            Set.Hat = BuildBox( head.TexOrigin( 32, 0 ).Expand( offset ) );
            Set.LeftArm = BuildBox( lArm.MirrorX().TexOrigin( 40, 16 ) );
            Set.RightArm = BuildBox( rArm.TexOrigin( 40, 16 ) );
            lArm = lArm.MirrorX(); lLeg = lLeg.MirrorX();

            Set64 = new ModelSet();
            Set64.Head = Set.Head;
            Set64.Torso = Set.Torso;
            Set64.LeftLeg = BuildBox( lLeg.TexOrigin( 16, 48 ) );
            Set64.RightLeg = Set.RightLeg;
            Set64.Hat = Set.Hat;
            Set64.LeftArm = BuildBox( lArm.TexOrigin( 32, 48 ) );
            Set64.RightArm = Set.RightArm;

            Set64.TorsoLayer = BuildBox( torso.TexOrigin( 16, 32 ).Expand( offset ) );
            Set64.LeftLegLayer = BuildBox( lLeg.TexOrigin( 0, 48 ).Expand( offset ) );
            Set64.RightLegLayer = BuildBox( rLeg.TexOrigin( 0, 32 ).Expand( offset ) );
            Set64.LeftArmLayer = BuildBox( lArm.TexOrigin( 48, 48 ).Expand( offset ) );
            Set64.RightArmLayer = BuildBox( rArm.TexOrigin( 40, 32 ).Expand( offset ) );

            SetSlim = new ModelSet();
            SetSlim.Head = Set64.Head;
            SetSlim.Torso = Set64.Torso;
            SetSlim.LeftLeg = Set64.LeftLeg;
            SetSlim.RightLeg = Set64.RightLeg;
            SetSlim.Hat = Set64.Hat;
            lArm.BodyW -= 1; lArm.X1 += (offset * 2)/16f;
            SetSlim.LeftArm = BuildBox( lArm.TexOrigin( 32, 48 ) );
            rArm.BodyW -= 1; rArm.X2 -= (offset * 2)/16f;
            SetSlim.RightArm = BuildBox( rArm.TexOrigin( 40, 16 ) );

            SetSlim.TorsoLayer = Set64.TorsoLayer;
            SetSlim.LeftLegLayer = Set64.LeftLegLayer;
            SetSlim.RightLegLayer = Set64.RightLegLayer;
            SetSlim.LeftArmLayer = BuildBox( lArm.TexOrigin( 48, 48 ).Expand( offset ) );
            SetSlim.RightArmLayer = BuildBox( rArm.TexOrigin( 40, 32 ).Expand( offset ) );
        }
Exemplo n.º 34
0
        protected override void DrawPlayerModel( Player p )
        {
            graphics.Texturing = true;
            int texId = p.PlayerTextureId <= 0 ? cache.HumanoidTexId : p.PlayerTextureId;
            graphics.BindTexture( texId );

            SkinType skinType = p.SkinType;
            _64x64 = skinType != SkinType.Type64x32;
            model = skinType == SkinType.Type64x64Slim ? SetSlim : Set;

            DrawRotate( 0, 24/16f, 0, -p.PitchRadians, 0, 0, model.Head );
            DrawPart( model.Torso );
            DrawRotate( 0, 12/16f, 0, p.leftLegXRot, 0, 0, model.LeftLeg );
            DrawRotate( 0, 12/16f, 0, p.rightLegXRot, 0, 0, model.RightLeg );
            DrawRotate( -6/16f, 22/16f, 0, p.leftArmXRot, 0, p.leftArmZRot, model.LeftArm );
            DrawRotate( 6/16f, 22/16f, 0, p.rightArmXRot, 0, p.rightArmZRot, model.RightArm );
            if( p.RenderHat ) {
                graphics.AlphaTest = true;
                DrawRotate( 0, 23.5f/16f, 0, -p.PitchRadians, 0, 0, model.Hat );
            }
        }
Exemplo n.º 35
0
        public PlayerModel( Game window )
            : base(window)
        {
            vertices = new ModelVertex[partVertices * ( 7 + 2 )];
            Set = new ModelSet();
            Set.Head = MakeHead( false );
            Set.Torso = MakeTorso( false );
            Set.LeftLeg = MakeLeftLeg( 0, 16, 4/16f, 0f, false );
            Set.RightLeg = MakeRightLeg( 0, 16, 0, 4/16f, false );
            Set.LeftArm = MakeLeftArm( 40, 16, 8/16f, 4/16f, 4, false );
            Set.RightArm = MakeRightArm( 40, 16, 4/16f, 8/16f, 4, false );
            Set.Hat = MakeHat( false );

            SetSlim = new ModelSet();
            SetSlim.Head = Set.Head;
            SetSlim.Torso = Set.Torso;
            SetSlim.LeftLeg = Set.LeftLeg;
            SetSlim.RightLeg = Set.RightLeg;
            SetSlim.LeftArm = MakeLeftArm( 32, 48, 4/16f, 7/16f, 3, true );
            SetSlim.RightArm = MakeRightArm( 40, 16, 4/16f, 7/16f, 3, true );
            SetSlim.Hat = Set.Hat;
        }
        public PlayerModel()
            : base()
        {
            vertices = new ModelVertex[boxVertices * ( 7 + 2 )];
            Set = new ModelSet();

            Set.Head = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                                .SetTexOrigin( 0, 0 ) );
            Set.Torso = BuildBox( MakeBoxBounds( -4, 12, -2, 4, 24, 2 )
                                 .SetTexOrigin( 16, 16 ) );
            Set.LeftLeg = BuildBox( MakeBoxBounds( 0, 0, -2, -4, 12, 2 )
                                   .SetTexOrigin( 0, 16 ) );
            Set.RightLeg = BuildBox( MakeBoxBounds( 0, 0, -2, 4, 12, 2 ).
                                    SetTexOrigin( 0, 16 ) );
            Set.Hat = BuildBox( MakeBoxBounds( -4, 24, -4, 4, 32, 4 )
                               .SetTexOrigin( 32, 0 )
                               .SetModelBounds( -4.5f, 23.5f, -4.5f, 4.5f, 32.5f, 4.5f ) );
            Set.LeftArm = BuildBox( MakeBoxBounds( -4, 12, -2, -8, 24, 2 )
                                   .SetTexOrigin( 40, 16 ) );
            Set.RightArm = BuildBox( MakeBoxBounds( 4, 12, -2, 8, 24, 2 )
                                    .SetTexOrigin( 40, 16 ) );

            texId = graphics.CreateTexture( "char.png" );
        }