Exemple #1
0
        protected override void Initialize()
        {
            SLText = new Text(GraphicsDevice, Services, SLConfig["content"], "Arial");
            Timer  = new SLTimer();
            Timer.Start();
            Input = new SLInput();

            BarPara bpara = BarPara.Default;

            bpara.width  = 3.5f;
            bpara.height = 0.7f;
            bpara.BasePara.orientation = 90.0f;
            Bar = new Bar(GraphicsDevice, bpara);

            GratingPara gpara = GratingPara.Default;

            gpara.BasePara.diameter = 2.0f;
            gpara.sf     = 0.8f;
            gpara.tf     = 3.0f;
            Grating      = new Grating(GraphicsDevice, Services, SLConfig["content"], gpara);
            GratingType  = Grating.Para.gratingtype;
            GratingShape = Grating.Para.shape;
            GratingMask  = Grating.Para.maskpara.masktype;

            Cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(1.0f, Color.Black, Vector3.Zero));

            Bgcolor    = Color.DimGray;
            CurrentSti = VSType.Bar;
            HelpText   = 0;
        }
Exemple #2
0
        /// <summary>
        /// Init Each Element of Collection According to StiLib Configuration, Custom Vision Stimulus Type and Parameters Object
        /// </summary>
        /// <param name="count"></param>
        /// <param name="vstype"></param>
        /// <param name="gd"></param>
        /// <param name="slconfig"></param>
        /// <param name="service"></param>
        /// <param name="path"></param>
        /// <param name="vspara"></param>
        public virtual void Init(int count, VSType vstype, GraphicsDevice gd, AssemblySettings slconfig, IServiceProvider service, string path, object vspara)
        {
            vsType temp = null;

            try
            {
                switch (vstype)
                {
                case VSType.Bar:
                    temp = new Bar(gd, slconfig, (BarPara)vspara) as vsType;
                    break;

                case VSType.Grating:
                    temp = new Grating(gd, slconfig, service, path, (GratingPara)vspara) as vsType;
                    break;

                case VSType.Image:
                    temp = new Image(gd, slconfig, service, path, (ImagePara)vspara) as vsType;
                    break;

                case VSType.Primitive:
                    temp = new Primitive(gd, slconfig, (PrimitivePara)vspara) as vsType;
                    break;

                case VSType.SLModel:
                    temp = new SLModel(gd, slconfig, service, path, (ModelPara)vspara) as vsType;
                    break;

                case VSType.SLQuad:
                    temp = new SLQuad(gd, slconfig, service, path, (Quad)vspara) as vsType;
                    break;

                case VSType.SLVideo:
                    temp = new SLVideo(gd, slconfig, service, path, (VideoPara)vspara) as vsType;
                    break;

                case VSType.Text:
                    temp = new Text(gd, slconfig, service, path, (TextPara)vspara) as vsType;
                    break;
                }

                Init(count, gd, temp);
            }
            catch (Exception e)
            {
                SLConstant.ShowException(e);
            }
        }
Exemple #3
0
        public string Src(string str, out VSType type, bool ignore_check = true, string security_key = "")
        {
            Match m = r_link.Match(str);

            if (m.Success)
            {
                (string link, string value) = (m.Groups[1].Value, m.Groups[2].Value);
                if (link_types.ContainsKey(link))
                {
                    if (link == "table" && security_key != "qwsazx123rty")
                    {
                        type = VSType.Error;
                        return(null);
                    }

                    int id = 4;
                    for (int i = 0; i < link_types.Keys.Count; i++)
                    {
                        if (link_types.Keys.ToArray()[i] == link)
                        {
                            id = i;
                        }
                    }
                    string result = Path.Combine(FullName, link_types[link], value);
                    type = (VSType)id;

                    if (!ignore_check && !File.Exists(result))
                    {
                        type = VSType.Not_Exists;
                        return(result);
                    }

                    return(result);
                }
                else
                {
                    type = VSType.Error;
                }
            }
            else
            {
                type = VSType.Error;
            }

            return(null);
        }
Exemple #4
0
        protected override void Update()
        {
            Input.Update();

            // Show Help Text
            if (Input.IsKeyPressed(Keys.F1))
            {
                HelpText += 1;
                if (HelpText > 2)
                {
                    HelpText = 0;
                }
            }
            // Toggle Full Screen
            if (Input.IsKeyPressed(Keys.F2))
            {
                ToggleFullScreen();
            }
            // Change Stimulus
            if (Input.IsKeyPressed(Keys.Q))
            {
                CurrentSti += 1;
                if ((int)CurrentSti > 2)
                {
                    CurrentSti = VSType.Bar;
                }
            }

            Refresh_Location();
            Refresh_BgColor();

            switch (CurrentSti)
            {
            case VSType.Grating:
                Update_Grating();
                break;

            default:
                Update_Bar();
                break;
            }
        }
Exemple #5
0
        public VariatingSprite GetSprite(ulong id, int variation, VSType t)
        {
            VariatingSprite variatingSprite1 = this._eggSprites.FirstOrDefault <VariatingSprite>((Func <VariatingSprite, bool>)(x => (long)x.id == (long)id && x.variation == variation && x.type == t));

            if (variatingSprite1 != null)
            {
                return(variatingSprite1);
            }
            VariatingSprite variatingSprite2 = new VariatingSprite();

            variatingSprite2.variation = variation;
            variatingSprite2.id        = id;
            variatingSprite2.type      = t;
            if (t == VSType.Egg)
            {
                variatingSprite2.sprite = Profile.GetEggSprite(variation, id);
            }
            else if (t == VSType.Portrait)
            {
                variatingSprite2.sprite = Profile.GetPaintingSprite(variation, id);
            }
            this._eggSprites.Add(variatingSprite2);
            return((VariatingSprite)null);
        }
Exemple #6
0
        protected override void Initialize()
        {
            SLText = new Text(GraphicsDevice, Services, SLConfig["content"], "Arial");
            Timer = new SLTimer();
            Timer.Start();
            Input = new SLInput();

            BarPara bpara = BarPara.Default;
            bpara.width = 3.5f;
            bpara.height = 0.7f;
            bpara.BasePara.orientation = 90.0f;
            Bar = new Bar(GraphicsDevice, bpara);

            GratingPara gpara = GratingPara.Default;
            gpara.BasePara.diameter = 2.0f;
            gpara.sf = 0.8f;
            gpara.tf = 3.0f;
            Grating = new Grating(GraphicsDevice, Services, SLConfig["content"], gpara);
            GratingType = Grating.Para.gratingtype;
            GratingShape = Grating.Para.shape;
            GratingMask = Grating.Para.maskpara.masktype;

            Cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(1.0f, Color.Black, Vector3.Zero));

            Bgcolor = Color.DimGray;
            CurrentSti = VSType.Bar;
            HelpText = 0;
        }
Exemple #7
0
        protected override void Update()
        {
            Input.Update();

            // Show Help Text
            if (Input.IsKeyPressed(Keys.F1))
            {
                HelpText += 1;
                if (HelpText > 2) HelpText = 0;
            }
            // Toggle Full Screen
            if (Input.IsKeyPressed(Keys.F2))
            {
                ToggleFullScreen();
            }
            // Change Stimulus
            if (Input.IsKeyPressed(Keys.Q))
            {
                CurrentSti += 1;
                if ((int)CurrentSti > 2) CurrentSti = VSType.Bar;
            }

            Refresh_Location();
            Refresh_BgColor();

            switch (CurrentSti)
            {
                case VSType.Grating:
                    Update_Grating();
                    break;
                default:
                    Update_Bar();
                    break;
            }
        }
Exemple #8
0
 /// <summary>
 /// Gets Default BasePara Except VSType and PrimitiveType
 /// </summary>
 /// <param name="vstype"></param>
 /// <param name="ptype"></param>
 /// <returns></returns>
 public static vsBasePara VS_PTypeDefault(VSType vstype, PrimitiveType ptype)
 {
     return new vsBasePara(Vector3.Zero, 5.0f, 0.0f, Vector3.Zero, 0.0f, Vector3.Zero, 0.0f, 0.0f, Vector3.Zero, 10.0f, Color.White, true, vstype, "BasicEffect", 1.0, ptype);
 }
Exemple #9
0
 /// <summary>
 /// Gets Default BasePara Except VSType, PrimitiveType and ContentName
 /// </summary>
 /// <param name="vstype"></param>
 /// <param name="ptype"></param>
 /// <param name="contentname"></param>
 /// <returns></returns>
 public static vsBasePara VS_PTypeContentDefault(VSType vstype, PrimitiveType ptype, string contentname)
 {
     return new vsBasePara(Vector3.Zero, 5.0f, 0.0f, Vector3.Zero, 0.0f, Vector3.Zero, 0.0f, 0.0f, Vector3.Zero, 10.0f, Color.White, true, vstype, contentname, 1.0, ptype);
 }
Exemple #10
0
 /// <summary>
 /// Initialize BasePara Using Custom Parameters
 /// </summary>
 /// <param name="center"></param>
 /// <param name="diameter"></param>
 /// <param name="orientation"></param>
 /// <param name="orientation3d"></param>
 /// <param name="rotationspeed"></param>
 /// <param name="rotationspeed3d"></param>
 /// <param name="direction"></param>
 /// <param name="speed"></param>
 /// <param name="speed3d"></param>
 /// <param name="space"></param>
 /// <param name="color"></param>
 /// <param name="visible"></param>
 /// <param name="vstype"></param>
 /// <param name="contentname"></param>
 /// <param name="lifetime"></param>
 /// <param name="primitivetype"></param>
 public vsBasePara(Vector3 center, float diameter, float orientation, Vector3 orientation3d, float rotationspeed, Vector3 rotationspeed3d, float direction, float speed, Vector3 speed3d, float space, Color color, bool visible, VSType vstype, string contentname, double lifetime, PrimitiveType primitivetype)
 {
     this.center = center;
     this.diameter = diameter;
     this.orientation = orientation;
     this.orientation3D = orientation3d;
     this.rotationspeed = rotationspeed;
     this.rotationspeed3D = rotationspeed3d;
     this.direction = direction;
     this.speed = speed;
     this.speed3D = speed3d;
     this.space = space;
     this.color = color;
     this.visible = visible;
     this.vstype = vstype;
     this.contentname = contentname;
     this.lifetime = lifetime;
     this.primitivetype = primitivetype;
 }
Exemple #11
0
 /// <summary>
 /// Init Each Element of Collection According to StiLib Configuration, CollectionPara,
 /// Custom Vision Stimulus Type and Parameters Object
 /// </summary>
 /// <param name="count"></param>
 /// <param name="vstype"></param>
 /// <param name="gd"></param>
 /// <param name="slconfig"></param>
 /// <param name="service"></param>
 /// <param name="path"></param>
 /// <param name="vspara"></param>
 /// <param name="collectpara"></param>
 public VSCollection(int count, VSType vstype, GraphicsDevice gd, AssemblySettings slconfig, IServiceProvider service, string path, object vspara, CollectionPara collectpara)
     : this(collectpara)
 {
     Init(count, vstype, gd, slconfig, service, path, vspara);
 }
Exemple #12
0
 /// <summary>
 /// Init Each Element of Collection According to Custom Vision Stimulus Type and Parameters Object
 /// </summary>
 /// <param name="count"></param>
 /// <param name="vstype"></param>
 /// <param name="gd"></param>
 /// <param name="service"></param>
 /// <param name="path"></param>
 /// <param name="vspara"></param>
 public VSCollection(int count, VSType vstype, GraphicsDevice gd, IServiceProvider service, string path, object vspara)
     : this()
 {
     Init(count, vstype, gd, service, path, vspara);
 }