/// <summary>
		/// Attribute constructor
		/// </summary>
		/// <param name="paramName">Name of key to validate</param>
		/// <param name="paramType">Type of key to validate</param>
		/// <param name="regExPattern">Regular expression to be matched</param>
		/// <param name="exceptionToThrow">Exception to throw on failed validation</param>
		public RegExPreconditionFilter(string paramName, ParamType paramType, string regExPattern, Type exceptionToThrow)
		{
			_paramName = paramName;
			_paramType = paramType;
			_regExPattern = regExPattern;
			_exceptionToThrow = exceptionToThrow;
			_thrownExceptionMessage = Enum.GetName(typeof(ParamType), paramType) + " parameter '" + paramName + "' does not match regex " + regExPattern;
		}
 /// <summary>
 /// Attribute constructor
 /// </summary>
 /// <param name="paramName">Name of key to validate</param>
 /// <param name="paramType">Type of key to validate</param>
 /// <param name="predicateMethod">Predicate&lt;object&gt; method that encapsulates validation logic</param>
 /// <param name="exceptionToThrow">Exception to throw on failed validation</param>
 public PredicatePreconditionFilter(string paramName, ParamType paramType, string predicateMethod, Type exceptionToThrow)
 {
     _paramName = paramName;
     _paramType = paramType;
     _predicateMethod = predicateMethod;
     _exceptionToThrow = exceptionToThrow;
     _thrownExceptionMessage = Enum.GetName(typeof(ParamType), paramType) + " parameter '" + paramName + "' does not satisfy predicate method " + predicateMethod;
 }
Esempio n. 3
0
 public AnySDKParam(bool nValue)
 {
     _intValue = 0;
     _floatValue = 0;
     _boolValue = nValue;
     _strValue = null;
     _strMapValue = null;
     _type = ParamType.kParamTypeBool;
 }
Esempio n. 4
0
 public AnySDKParam(string nValue)
 {
     _intValue = 0;
     _floatValue = 0;
     _boolValue = false;
     _strValue = nValue;
     _strMapValue = null;
     _type = ParamType.kParamTypeString;
 }
Esempio n. 5
0
 public AnySDKParam(Dictionary<string,string> nValue)
 {
     _intValue = 0;
     _floatValue = 0;
     _boolValue = false;
     _strValue = null;
     _strMapValue = AnySDKUtil.dictionaryToString( nValue);
     _type = ParamType.kParamTypeStringMap;
 }
Esempio n. 6
0
 public AnySDKParam(float nValue)
 {
     _intValue = 0;
     _floatValue = nValue;
     _boolValue = false;
     _strValue = null;
     _strMapValue = null;
     _type = ParamType.kParamTypeFloat;
 }
 public static ServerConnectionParameter Create(string schemaName, string displayName, ParamType type = ParamType.String, object defaultValue = null, bool optional = false) {
   return new ServerConnectionParameter() { 
     SchemaName = schemaName,
     DisplayName = displayName,
     
     Type = type,
     DefaultValue = defaultValue,
     Optional = optional
   };
 }
Esempio n. 8
0
 public static IShaderParam Create(ParamType type)
 {
     switch(type)
     {
         case ParamType.Texture:
             return new ShaderParamTexture();
         case ParamType.Vector4:
             return new ShaderParamVector4();
         case ParamType.Matrix:
             return new ShaderParamMatrix();
         default:
             throw new ArgumentOutOfRangeException("type");
     }
 }
Esempio n. 9
0
 public ParameterEffect(Unit targetUnit, float totalTime, ParamType type, float coef , bool plus = true)
     : base(targetUnit, totalTime)
 {
     this.Type = type;
     EffectType = EffectType.parameter;
     this.coef = coef;
     this.plus = plus;
     if (plus)
     {
         targetUnit.Parameters[type] *= coef;
     }
     else
     {
         targetUnit.Parameters[type] /= coef;
     }
     CheckOnSpeed();
     var visualEffect = DataBaseController.Instance.Pool.GetItemFromPool(EffectType);
     visualEffect.Init(targetUnit, endEffect);
     var paramColor = DataBaseController.Instance.GetColor(type);
     visualEffect.SetColor(paramColor);
     var oldP = visualEffect.transform.localPosition;
     visualEffect.transform.localPosition = new Vector3(oldP.x,oldP.y + Random.Range(0, 2), oldP.z );
 }
Esempio n. 10
0
    protected void OnBtnSaveClicked(object sender, EventArgs e)
    {
        ParamTypeRepository repo = new ParamTypeRepository();

        ParamType saveItem = new ParamType();
        saveItem.TypeID = txtTypeID.Text;
        saveItem.Label = txtLabel.Text;

        if (Request.QueryString["TypeID"] == null)
        {
            ParamType oldItem = repo.FindOne(new ParamType(txtTypeID.Text));
            if (oldItem == null)
                repo.InserNewUnit(saveItem);
            else
            {
                string message = ResourceManager.GetString("itemAlreadyExist");
                string script1 = "<script type=\"text/javascript\">";
                script1 += " alert(\"" + message + "\");";
                script1 += " </script>";

                if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
                    ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script1);
            }
        }
        else
        {
            repo.Update(saveItem);
        }

        string script = "<script type=\"text/javascript\">";
        script += " OnBtnSaveClientClicked();";
        script += " </script>";

        if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
            ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script);
    }
Esempio n. 11
0
        private static IEnumerable<TypeInfo> GetTypeInfo(Type type, ParamType paramType, bool getDetailedTypes)
        {
            var attr = type.GetCustomAttribute<DataContractAttribute>();

            if (attr != null)
            {
                yield return new TypeInfo()
                {
                    Name =
                        (attr.Namespace ?? "http://schemas.datacontract.org/2004/07/" + type.Namespace).
                            TrimEnd(
                                '/')
                        + "/" + (attr.Name ?? type.Name),
                    Type = type,
                    ParamType = paramType
                };

            }
            else if (type.IsPrimitive || type == typeof(string) || type.IsArray || type.IsGenericType)
            {
                yield return new TypeInfo()
                {
                    Name = GetDetailedName(type),
                    Type = type,
                    ParamType = paramType
                };

            }
            else
            {
                throw new InvalidOperationException(
                    string.Format(
                        "The type {0} does not have a data contract attribute and is not a primitive type.",
                        type.FullName));
            }
        }
Esempio n. 12
0
    protected void OnUnitDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        string unit = lnkItem.CommandArgument;

        ParamType deleteItem = new ParamType();
        deleteItem.TypeID = unit;
        ParamTypeRepository repo = new ParamTypeRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridUnits.DataBind();
    }
Esempio n. 13
0
 public static bool hasParam(int param, ParamType paramType)
 {
     return((param & (int)paramType) != 0);
 }
Esempio n. 14
0
 public EdgeTypeParamDefinition(ParamType type, object param)
 {
     // TODO: Complete member initialization
     this.Type = type;
     this.Param = param;
 }
Esempio n. 15
0
 public VideoFormatException(ParamType paramType, string message, Exception innerException = null)
     : base(message, innerException)
 {
     ParamType = paramType;
 }
Esempio n. 16
0
 public ConfigParamAttribute(ParamType type, object defaultVal)
 {
     DefaultValue = defaultVal;
     Type = type;
     Description = "";
 }
Esempio n. 17
0
        private static string FormatEndpointsParamString(IEnumerable <Endpoint> endpoints, ParamType type)
        {
            string value = "";
            string param = "";
            // TODO: Add support for Port and Protocol... Right now, Protocol = All...
            // If Port type, check to see if all Endpoint Port properties are -1 or less...
            // If so, then return an empty string...
            var enumerable = endpoints as IList <Endpoint> ?? endpoints.ToList();

            if (type == ParamType.Port && enumerable.All(endpoint => endpoint.Port <= -1))
            {
                return("");
            }

            foreach (var endpoint in enumerable)
            {
                if (type == ParamType.Hostname)
                {
                    var endpointHostName = endpoint.Hostname;                     //user can supply Url or domain in Chaos.config...
                    if (endpoint.Hostname.StartsWith("https", StringComparison.Ordinal) || endpoint.Hostname.StartsWith("http", StringComparison.Ordinal))
                    {
                        var uri = new Uri(endpoint.Hostname);
                        endpointHostName = uri.DnsSafeHost;
                    }

                    var ips = GetIpAddressesForEndpoint(endpointHostName);
                    value = ips.Aggregate(value, (current, ip) => current + (IPAddress.Parse(string.Join(".", ip)) + ","));
                }
                else                 //TODO...
                {
                    param = endpoint.Port.ToString();
                }
            }

            return(value.TrimEnd(','));
        }
Esempio n. 18
0
 /// <summary>
 /// Creates a program parameter with a type, name, program and location.
 /// </summary>
 /// <param name="Type">Specifies the C# equivalent of the GLSL data type.</param>
 /// <param name="ParamType">Specifies the parameter type (either attribute or uniform).</param>
 /// <param name="Name">Specifies the case-sensitive name of the parameter.</param>
 /// <param name="Program">Specifies the OpenGL program ID.</param>
 /// <param name="Location">Specifies the location of the parameter.</param>
 public ProgramParam(Type Type, ParamType ParamType, string Name, uint Program, int Location)
     : this(Type, ParamType, Name)
 {
     programid = Program;
     location  = Location;
 }
 public JobEditorParameter(string Name, ParamType ParameterType)
 {
     this.Name      = Name;
     this.paramType = ParameterType;
 }
Esempio n. 20
0
 /// <summary>
 /// Creates a program parameter with a given type and name.
 /// The location must be found after the program is compiled
 /// by using the GetLocation(ShaderProgram Program) method.
 /// </summary>
 /// <param name="Type">Specifies the C# equivalent of the GLSL data type.</param>
 /// <param name="ParamType">Specifies the parameter type (either attribute or uniform).</param>
 /// <param name="Name">Specifies the case-sensitive name of the parameter.</param>
 public ProgramParam(Type Type, ParamType ParamType, string Name)
 {
     type  = Type;
     ptype = ParamType;
     name  = Name;
 }
 public ListParameter(string Name, ParamType ParameterType, List <string> DefaultValue)
     : base(Name, ParameterType)
 {
     this.Value = DefaultValue;
 }
 public BooleanParameter(string Name, ParamType ParameterType, bool DefaultValue)
     : base(Name, ParameterType)
 {
     this.Value = DefaultValue;
 }
 public TextParameter(string Name, ParamType ParameterType, string DefaultValue)
     : base(Name, ParameterType)
 {
     this.Value = DefaultValue;
 }
Esempio n. 24
0
 /// <summary>
 /// Creates a program parameter with a type, name, program and location.
 /// </summary>
 /// <param name="Type">Specifies the C# equivalent of the GLSL data type.</param>
 /// <param name="ParamType">Specifies the parameter type (either attribute or uniform).</param>
 /// <param name="Name">Specifies the case-sensitive name of the parameter.</param>
 /// <param name="Program">Specifies the OpenGL program ID.</param>
 /// <param name="Location">Specifies the location of the parameter.</param>
 public ProgramParam(Type Type, ParamType ParamType, string Name, uint Program, int Location)
     : this(Type, ParamType, Name)
 {
     programid = Program;
     location = Location;
 }
Esempio n. 25
0
 public ParamDefinition(string AID, ParamType AType, object AValue)
     : this(AID, AType)
 {
     Value = AValue;
 }
Esempio n. 26
0
 public ParamDefinition(string AID, ParamType AType)
     : this(AID)
 {
     Type = AType;
 }
Esempio n. 27
0
 public StatementParameter(string name, ParamType type, object value)
 {
     this._param = name;
     this._type  = type;
     this._value = value;
 }
Esempio n. 28
0
        /// <summary>
        /// Warning!!! if we can't urlpath on databing
        /// </summary>
        /// <param name="type"></param>
        /// <param name="objId"></param>
        /// <returns></returns>
        public static string GetLinkDB(ParamType type, int objId)
        {
            var objUrl = GetObjUrlFromDb(type, objId);

            return(GetLink(type, objUrl, objId));
        }
Esempio n. 29
0
            internal Param(BinaryReaderEx br)
            {
                br.AssertInt32(0);
                Unk04 = br.ReadInt32();
                br.AssertInt32(4);
                br.AssertInt32(4);
                AssertMarker(br, 0xA3);
                Name = br.ReadShiftJISLengthPrefixed(0xA3);
                string type = br.ReadShiftJISLengthPrefixed(0x04);

                Type = (ParamType)Enum.Parse(typeof(ParamType), type, true);
                br.AssertInt32(1);
                br.AssertInt32(0);
                int valueSize = br.ReadInt32();

                if (Type == ParamType.Bool)
                {
                    br.AssertByte(0);
                }
                else if (Type == ParamType.Int || Type == ParamType.Int2)
                {
                    br.AssertByte(1);
                }
                else if (Type == ParamType.Float || Type == ParamType.Float2 || Type == ParamType.Float3 || Type == ParamType.Float4)
                {
                    br.AssertByte(2);
                }
                br.AssertByte(0x10);
                br.AssertByte(0);
                br.AssertByte(0);

                br.AssertInt32(1);
                if (Type == ParamType.Bool)
                {
                    AssertMarker(br, 0xC0);
                }
                else if (Type == ParamType.Int || Type == ParamType.Int2)
                {
                    AssertMarker(br, 0xC5);
                }
                else if (Type == ParamType.Float || Type == ParamType.Float2 || Type == ParamType.Float3 || Type == ParamType.Float4)
                {
                    AssertMarker(br, 0xCA);
                }

                if (Type == ParamType.Bool || Type == ParamType.Float || Type == ParamType.Int)
                {
                    br.AssertInt32(1);
                }
                else if (Type == ParamType.Float2 || Type == ParamType.Int2)
                {
                    br.AssertInt32(2);
                }
                else if (Type == ParamType.Float3)
                {
                    br.AssertInt32(3);
                }
                else if (Type == ParamType.Float4)
                {
                    br.AssertInt32(4);
                }

                if (Type == ParamType.Int)
                {
                    Value = br.ReadInt32();
                }
                else if (Type == ParamType.Int2)
                {
                    Value = br.ReadInt32s(2);
                }
                else if (Type == ParamType.Bool)
                {
                    Value = br.ReadBoolean();
                }
                else if (Type == ParamType.Float)
                {
                    Value = br.ReadSingle();
                }
                else if (Type == ParamType.Float2)
                {
                    Value = br.ReadSingles(2);
                }
                else if (Type == ParamType.Float3)
                {
                    Value = br.ReadSingles(3);
                }
                else if (Type == ParamType.Float4)
                {
                    Value = br.ReadSingles(4);
                }

                br.AssertByte(4);
                br.Pad(4);
                br.AssertInt32(0);
            }
            public Parameter(string parameterName, string parameterValue, ParamType parameterType)
            {
                parameter_name = parameterName;
                                parameter_value = parameterValue;
                                parameter_type = parameterType;

                                if (parameter_type == ParamType.File) {
                                        if (!File.Exists (parameter_value))
                                                throw new ArgumentException("File is not exist under the path",
                                                                "parameterValue");
                                }
            }
Esempio n. 31
0
 public Parameter(object value, ParamType type, string description)
     : this(value, type)
 {
     Description = description;
 }
        public VisualParamEx(XmlNode node, ParamType pt)
        {
            pType = pt;

            ParamID = Int32.Parse(node.Attributes.GetNamedItem("id").Value);
            Name = node.Attributes.GetNamedItem("name").Value;
            Group = Int32.Parse(node.Attributes.GetNamedItem("group").Value);

            //These dont exist for facal expresion morphs
            if (node.Attributes.GetNamedItem("wearable") != null)
                Wearable = node.Attributes.GetNamedItem("wearable").Value;

            MinValue = float.Parse(node.Attributes.GetNamedItem("value_min").Value);
            MaxValue = float.Parse(node.Attributes.GetNamedItem("value_max").Value);

            // These do not exists for driven parameters
            if (node.Attributes.GetNamedItem("label_min") != null)
            {
                LabelMin = node.Attributes.GetNamedItem("label_min").Value;
            }

            if (node.Attributes.GetNamedItem("label_max") != null)
            {
                LabelMax = node.Attributes.GetNamedItem("label_max").Value;
            }

            XmlNode sexnode = node.Attributes.GetNamedItem("sex");

            if (sexnode != null)
            {
                if (sexnode.Value == "male")
                {
                    sex = EparamSex.SEX_MALE;
                }
                else
                {
                    sex = EparamSex.SEX_FEMALE;
                }

            }

            Group = int.Parse(node.Attributes.GetNamedItem("group").Value);

            if (Group == (int)GroupType.VISUAL_PARAM_GROUP_TWEAKABLE)
            {
                if (!tweakable_params.ContainsKey(ParamID)) //stupid duplicate shared params
                {
                    tweakable_params.Add(this.ParamID, this);
                }
                //Logger.Log(String.Format("Adding tweakable paramater ID {0} {1}", count, this.Name), Helpers.LogLevel.Info);
                count++;
            }

            //TODO other paramaters but these arew concerned with editing the GUI display so not too fussed at the moment

            try
            {
                allParams.Add(ParamID, this);
            }
            catch
            {
                Logger.Log("Duplicate VisualParam in allParams id " + ParamID.ToString(), Helpers.LogLevel.Info);
            }

            if (pt == ParamType.TYPE_BONEDEFORM)
            {
                // If we are in the skeleton section then we also have bone deforms to parse
                BoneDeforms = new Dictionary<string, Vector3>();
                if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes)
                {
                    ParseBoneDeforms(node.ChildNodes[0].ChildNodes);
                }
                deformParams.Add(ParamID, this);
            }

            if (pt == ParamType.TYPE_MORPH)
            {
                VolumeDeforms = new Dictionary<string, VolumeDeform>();
                if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes)
                {
                    ParseVolumeDeforms(node.ChildNodes[0].ChildNodes);
                }

                try
                {
                    morphParams.Add(ParamID, this);
                }
                catch
                {
                    Logger.Log("Duplicate VisualParam in morphParams id " + ParamID.ToString(), Helpers.LogLevel.Info);
                }

            }

            if (pt == ParamType.TYPE_DRIVER)
            {
                childparams = new List<driven>();
                if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) //LAZY
                {
                    ParseDrivers(node.ChildNodes[0].ChildNodes);
                }

                drivenParams.Add(ParamID, this);

            }

            if (pt == ParamType.TYPE_COLOR)
            {
                if (node.HasChildNodes)
                {
                    foreach (XmlNode colorchild in node.ChildNodes)
                    {
                        if (colorchild.Name == "param_color")
                        {
                            //TODO extract <value color="50, 25, 5, 255" />
                        }
                    }

                }
            }
        }
Esempio n. 33
0
    public static float AffectMainParam(float curVal ,Dictionary<MainParam, int> MainParameters,ParamType type)
    {
        switch (type)
        {
            case ParamType.Speed:
                curVal += 400;
                break;
            case ParamType.MPower:
                curVal += MainParameters[MainParam.ATTACK] * PATTACK_COEF + 12;
                break;
            case ParamType.PPower:
                curVal += MainParameters[MainParam.ATTACK] * MATTACK_COEF + 26;
                break;
            case ParamType.PDef:
                curVal += MainParameters[MainParam.DEF] * PDEF_COEF + 20;
                break;
            case ParamType.MDef:
                curVal += MainParameters[MainParam.DEF] * MDEF_COEF + 10;
                break;
            case ParamType.Heath:
                curVal += MainParameters[MainParam.HP] * HP_COEF + 300;//200
#if UNITY_EDITOR
                if (DebugController.Instance.MAIN_HERO_MEGAHP)
                {
                    curVal += 999999;
                }
#endif
                break;
        }
        return curVal;
    }
Esempio n. 34
0
 public ConfigParamAttribute(ParamType type, object defaultVal, string description)
     : this(type, defaultVal)
 {
     this.Description = description;
 }
Esempio n. 35
0
 public ParamDefinition(string AID, ParamType AType, object AValue)
     : this(AID, AType)
 {
     Value = AValue;
 }
Esempio n. 36
0
 public VideoFormatException(ParamType paramType, Exception innerException = null)
     : base(innerException)
 {
     ParamType = paramType;
 }
Esempio n. 37
0
        public VisualParamEx(XmlNode node)
        {
            ParamID = Int32.Parse(node.Attributes.GetNamedItem("id").Value);
            Name = node.Attributes.GetNamedItem("name").Value;
            Group = Int32.Parse(node.Attributes.GetNamedItem("group").Value);

            //These dont exist for facal expresion morphs
            if (node.Attributes.GetNamedItem("wearable") != null)
                Wearable = node.Attributes.GetNamedItem("wearable").Value;

            MinValue = float.Parse(node.Attributes.GetNamedItem("value_min").Value, Utils.EnUsCulture);
            MaxValue = float.Parse(node.Attributes.GetNamedItem("value_max").Value, Utils.EnUsCulture);

            // These do not exists for driven parameters
            if (node.Attributes.GetNamedItem("label_min") != null)
            {
                LabelMin = node.Attributes.GetNamedItem("label_min").Value;
            }

            if (node.Attributes.GetNamedItem("label_max") != null)
            {
                LabelMax = node.Attributes.GetNamedItem("label_max").Value;
            }

            XmlNode sexnode = node.Attributes.GetNamedItem("sex");

            if (sexnode != null)
            {
                if (sexnode.Value == "male")
                {
                    sex = EparamSex.SEX_MALE;
                }
                else
                {
                    sex = EparamSex.SEX_FEMALE;
                }
            }

            if (node.ParentNode.Name == "mesh")
            {
                this.morphmesh = node.ParentNode.Attributes.GetNamedItem("type").Value;
            }

            Group = int.Parse(node.Attributes.GetNamedItem("group").Value);

            if (Group == (int)GroupType.VISUAL_PARAM_GROUP_TWEAKABLE)
            {
                if (!tweakable_params.ContainsKey(ParamID)) //stupid duplicate shared params
                {
                    tweakable_params.Add(this.ParamID, this);
                }
                else
                {
                    Logger.Log(String.Format("Warning duplicate tweakable paramater ID {0} {1}", count, this.Name), Helpers.LogLevel.Warning);
                }
                count++;
            }

            if (allParams.ContainsKey(ParamID))
            {
                //Logger.Log("Shared VisualParam id " + ParamID.ToString() + " "+Name, Helpers.LogLevel.Info);
                allParams[ParamID].identicalIds.Add(this);
            }
            else
            {
                //Logger.Log("VisualParam id " + ParamID.ToString() + " " + Name, Helpers.LogLevel.Info);
                allParams.Add(ParamID, this);
            }

            if (matchchildnode("param_skeleton", node))
            {
                pType = ParamType.TYPE_BONEDEFORM;
                // If we are in the skeleton section then we also have bone deforms to parse
                BoneDeforms = new Dictionary<string, BoneDeform>();
                if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes)
                {
                    ParseBoneDeforms(node.ChildNodes[0].ChildNodes);
                }
            }

            if (matchchildnode("param_morph", node))
            {
                pType = ParamType.TYPE_MORPH;

                VolumeDeforms = new Dictionary<string, VolumeDeform>();
                if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes)
                {
                    ParseVolumeDeforms(node.ChildNodes[0].ChildNodes);
                }
            }

            if (matchchildnode("param_driver", node))
            {
                pType = ParamType.TYPE_DRIVER;
                childparams = new List<driven>();
                if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) //LAZY
                {
                    ParseDrivers(node.ChildNodes[0].ChildNodes);
                }
            }

            if (matchchildnode("param_color", node))
            {
                pType = ParamType.TYPE_COLOR;
                if (node.HasChildNodes)
                {
                    foreach (XmlNode colorchild in node.ChildNodes)
                    {
                        if (colorchild.Name == "param_color")
                        {
                            //TODO extract <value color="50, 25, 5, 255" />
                        }
                    }
                }
            }
        }
Esempio n. 38
0
 /// <summary>
 /// create url-string
 /// </summary>
 /// <param name="objId"></param>
 /// <param name="objUrl"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetLink(ParamType type, string objUrl, int objId)
 {
     return(GetLink(type, objUrl, objId, string.Empty));
 }
        // -----------------------------
        public async Task <Tuple <bool, KnownUOM> > ShowChooseUom(ContentManager contentManager, ParamType paramType)
        {
            VmChooseUom     vmUom = new VmChooseUom(contentManager, paramType);
            VwChooseUomPage vw    = new VwChooseUomPage(vmUom, isModal: true);

            await Navigation.PushModalAsync(vw);

            await vw.PageClosedTask; // Wait here until the Page is dismissed

            return(new Tuple <bool, KnownUOM> (vmUom.SelectionCancelled, vmUom.SelectedUOM));
        }
Esempio n. 40
0
 public Parameter(object value, ParamType type)
 {
     ValType = type;
     Value = value;
     Description = "";
 }
Esempio n. 41
0
 /// <summary>
 /// return url link
 /// </summary>
 /// <param name="objId"></param>
 /// <param name="objUrl"></param>
 /// <param name="type"></param>
 /// <param name="query"></param>
 /// <returns></returns>
 public static string GetLink(ParamType type, string objUrl, int objId, string query)
 {
     return(string.IsNullOrEmpty(objUrl)
         ? NamesAndPages[type] + '?' + NamesAndIds[type] + "=" + objId + (string.IsNullOrEmpty(query) ? string.Empty : '&' + query)
         : NamesAndWords[type] + '/' + objUrl + (string.IsNullOrEmpty(query) ? string.Empty : '?' + query));
 }
Esempio n. 42
0
 public Param(string TypeName, string MappedType, string Name, string MappedName, ParamType Type)
 {
     this.TypeName = TypeName;
     this.MappedType = MappedType;
     this.Name = Name;
     this.MappedName = MappedName;
     this.Type = Type;
 }
Esempio n. 43
0
    public ShakeAnimInfo(GameObject obj, Vector3 initialVector, float range, float time, float updateTime, ParamType paramType, AnimType animType, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None)
        : base(obj, range, paramType, animType, time, delay, endOption)
    {
        if (paramType < ParamType.Position || ParamType.PositionZ < paramType)
        {
            throw new System.Exception("ShakeAnimInfo: wrong param type! paramType = " + paramType.ToString());
        }

        initialVector_ = initialVector;
        timer_         = 0;
        shakeCount_    = 0;
        updateTime_    = updateTime;
    }
Esempio n. 44
0
 public ParamDefinition(string AID, ParamType AType)
     : this(AID)
 {
     Type = AType;
 }
Esempio n. 45
0
    public static void AddShakeAnim(Object obj, Vector3 initialVector, float range, float time, float updateTime, ParamType paramType, AnimType animType = AnimType.Time, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None)
    {
        GameObject gameObject = ToGameObject(obj);

        Instance.Animations.Add(new ShakeAnimInfo(gameObject, initialVector, range, time, updateTime, paramType, animType, delay, endOption));
    }
Esempio n. 46
0
 public Param(string name, ParamType type)
 {
     this.name = name;
     this.type = type;
 }
Esempio n. 47
0
 public static void RemoveOtherAnim(Object obj, ParamType type = ParamType.Any, bool includeDaly = true)
 {
     Instance.removeAnims_.AddRange(from other in Instance.Animations
                                    where other.Object == ToGameObject(obj) && (type == ParamType.Any || type == other.Param) && (includeDaly || other.IsPlaying)
                                    select other);
 }
Esempio n. 48
0
 public float CalcParameter(ParamType type)
 {
     float v = 0;
     foreach (PlayerItem playerItem in playerItems.Where(x=>x.IsEquped &&  x is PlayerItem && (x as PlayerItem).parameters.ContainsKey(type)))
     {
         foreach (var parameter in playerItem.parameters)
         {
             if (parameter.Key == type)
             {
                 v += parameter.Value;
             }
         }
     }
     switch (type)
     {
         case ParamType.Speed:
             v += 4;
             break;
         case ParamType.MPower:
             v += MainParameters[MainParam.ATTACK] * 12 + 36;
             break;
         case ParamType.PPower:
             v += MainParameters[MainParam.ATTACK] * 10 + 32;
             break;
         case ParamType.PDef:
             v += MainParameters[MainParam.DEF] * 10 + 10;
             break;
         case ParamType.MDef:
             v += MainParameters[MainParam.DEF] * 9;
             break;
         case ParamType.Hp:
             v += MainParameters[MainParam.HP] * 40 + 200;
             break;
     }
     return v;
 }
Esempio n. 49
0
        /// <summary>
        /// 发送请求
        /// </summary>
        /// <param name="URL">URL地址</param>
        /// <param name="Params">参数</param>
        /// <param name="methodType">发送类型</param>
        /// <param name="paramType">参数类型</param>
        /// <param name="dataEncode">编码类型</param>
        /// <returns>返回结果</returns>
        public static string SendRequest(string URL, string Params, MethodType methodType, ParamType paramType, Encoding dataEncode = null)
        {
            if (dataEncode == null)
            {
                dataEncode = Encoding.UTF8;
            }
            HttpWebRequest webReq;

            if (methodType == MethodType.Get)
            {
                webReq             = (HttpWebRequest)WebRequest.Create(new Uri(URL + Params));
                webReq.Method      = "GET";
                webReq.ContentType = "text/html;charset=UTF-8";
            }
            else
            {
                webReq        = (HttpWebRequest)WebRequest.Create(new Uri(URL));
                webReq.Method = "POST";
                switch (paramType)
                {
                case ParamType.Text:
                    webReq.ContentType = "text/html;charset=UTF-8";
                    break;

                case ParamType.Form:
                    webReq.ContentType = "application/x-www-form-urlencoded";
                    break;

                case ParamType.Json:
                    webReq.ContentType = "application/json;charset=UTF-8";
                    break;
                }
                byte[] byteArray = dataEncode.GetBytes(Params);
                Stream writer    = webReq.GetRequestStream();
                writer.Write(byteArray, 0, byteArray.Length);
                writer.Close();
            }
            HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
            StreamReader    sr       = new StreamReader(response.GetResponseStream(), dataEncode);
            string          result   = sr.ReadToEnd();

            sr.Close();
            response.Close();
            return(result);
        }
Esempio n. 50
0
 /// <summary>
 /// Creates a program parameter with a given type and name.
 /// The location must be found after the program is compiled
 /// by using the GetLocation(ShaderProgram Program) method.
 /// </summary>
 /// <param name="Type">Specifies the C# equivalent of the GLSL data type.</param>
 /// <param name="ParamType">Specifies the parameter type (either attribute or uniform).</param>
 /// <param name="Name">Specifies the case-sensitive name of the parameter.</param>
 public ProgramParam(Type Type, ParamType ParamType, string Name)
 {
     type = Type;
     ptype = ParamType;
     name = Name;
 }
            internal Param(BinaryReaderEx br, GPGame game, Offsets offsets)
            {
                int paramHeaderOffset = br.ReadInt32();

                br.StepIn(offsets.ParamHeaders + paramHeaderOffset);
                {
                    int valuesOffset   = br.ReadInt32();
                    int valueIDsOffset = br.ReadInt32();

                    Type = br.ReadEnum8 <ParamType>();
                    byte valueCount = br.ReadByte();
                    br.AssertByte(0);
                    br.AssertByte(0);

                    if (Type == ParamType.Byte && valueCount > 1)
                    {
                        throw new Exception("Notify TKGP so he can look into this, please.");
                    }

                    if (game == GPGame.DarkSouls2)
                    {
                        Name1 = br.ReadShiftJIS();
                    }
                    else
                    {
                        Name1 = br.ReadUTF16();
                        Name2 = br.ReadUTF16();
                    }

                    br.StepIn(offsets.Values + valuesOffset);
                    {
                        Values = new List <object>(valueCount);
                        for (int i = 0; i < valueCount; i++)
                        {
                            switch (Type)
                            {
                            case ParamType.Byte:
                                Values.Add(br.ReadByte());
                                break;

                            case ParamType.Short:
                                Values.Add(br.ReadInt16());
                                break;

                            case ParamType.IntA:
                                Values.Add(br.ReadInt32());
                                break;

                            case ParamType.BoolA:
                                Values.Add(br.ReadBoolean());
                                break;

                            case ParamType.IntB:
                                Values.Add(br.ReadInt32());
                                break;

                            case ParamType.Float:
                                Values.Add(br.ReadSingle());
                                break;

                            case ParamType.BoolB:
                                Values.Add(br.ReadBoolean());
                                break;

                            case ParamType.Float2:
                                Values.Add(br.ReadVector2());
                                br.AssertInt32(0);
                                br.AssertInt32(0);
                                break;

                            case ParamType.Float3:
                                Values.Add(br.ReadVector3());
                                br.AssertInt32(0);
                                break;

                            case ParamType.Float4:
                                Values.Add(br.ReadVector4());
                                break;

                            case ParamType.Byte4:
                                Values.Add(br.ReadBytes(4));
                                break;
                            }
                        }
                    }
                    br.StepOut();

                    br.StepIn(offsets.ValueIDs + valueIDsOffset);
                    {
                        ValueIDs = new List <int>(valueCount);
                        if (game == GPGame.Sekiro)
                        {
                            UnkFloats = new List <float>(valueCount);
                        }
                        else
                        {
                            UnkFloats = null;
                        }

                        for (int i = 0; i < valueCount; i++)
                        {
                            ValueIDs.Add(br.ReadInt32());
                            if (game == GPGame.Sekiro)
                            {
                                UnkFloats.Add(br.ReadSingle());
                            }
                        }
                    }
                    br.StepOut();
                }
                br.StepOut();
            }
Esempio n. 52
0
        private void DoParse(string path)
        {
            using (var stream = File.Open(path, FileMode.Open))
            {
                stream.Seek(0x08, SeekOrigin.Begin);
                using (var reader = new BinaryReader(stream))
                {
                    IParamCollection col = new ParamList();
                    while (stream.Position != stream.Length)
                    {
                        ParamType type = (ParamType)stream.ReadByte();
                        switch (type)
                        {
                        case ParamType.s8:
                            col.Add(new ParamEntry(reader.ReadSByte(), type));
                            break;

                        case ParamType.u8:
                            col.Add(new ParamEntry(reader.ReadByte(), type));
                            break;

                        case ParamType.s16:
                            col.Add(new ParamEntry(reader.ReadInt16().Reverse(), type));
                            break;

                        case ParamType.u16:
                            col.Add(new ParamEntry(reader.ReadUInt16().Reverse(), type));
                            break;

                        case ParamType.s32:
                            col.Add(new ParamEntry(reader.ReadInt32().Reverse(), type));
                            break;

                        case ParamType.u32:
                            col.Add(new ParamEntry(reader.ReadUInt32().Reverse(), type));
                            break;

                        case ParamType.f32:
                            col.Add(new ParamEntry(reader.ReadSingle().Reverse(), type));
                            break;

                        case ParamType.str:
                            int len = reader.ReadInt32().Reverse();
                            col.Add(new ParamEntry(new string(reader.ReadChars(len)), type));
                            break;

                        case ParamType.group:
                            if (col.Values.Count > 0)
                            {
                                if (col is ParamGroup)
                                {
                                    ((ParamGroup)col).Chunk();
                                }
                                this.Groups.Add(col);
                            }

                            col = new ParamGroup();
                            int count = reader.ReadInt32().Reverse();
                            ((ParamGroup)col).EntryCount = count;
                            break;

                        default:
                            throw new NotImplementedException($"unk typecode: {type} at offset: {stream.Position:X}");
                        }
                    }

                    if (col.Values.Count > 0)
                    {
                        if (col is ParamGroup)
                        {
                            ((ParamGroup)col).Chunk();
                        }
                        this.Groups.Add(col);
                    }
                }
            }
        }
Esempio n. 53
0
 public CommandParamDecl(ParamType type, string name)
 {
     this.Type = type;
     this.Name = name;
 }