コード例 #1
0
        public void t叩ききりまショー_判定から各数値を増加させる(EJudge eJudge, int nLagTime)
        {
            this.st叩ききりまショー.b最初のチップが叩かれた = true;
            this.st叩ききりまショー.n区間ノート数++;
            this.st叩ききりまショー.n現在通過したノート数++;
            switch (eJudge)
            {
            case EJudge.Perfect:
                this.st叩ききりまショー.nヒット数_PERFECT++;
                break;

            case EJudge.Great:
                this.st叩ききりまショー.nヒット数_GREAT++;
                break;

            case EJudge.Good:
                this.st叩ききりまショー.nヒット数_GOOD++;
                break;

            case EJudge.Poor:
                this.st叩ききりまショー.nヒット数_POOR++;
                break;

            case EJudge.Miss:
                this.st叩ききりまショー.nヒット数_MISS++;
                break;
            }
            switch (eJudge)
            {
            case EJudge.Perfect:
            case EJudge.Great:
            case EJudge.Good:
                this.st叩ききりまショー.n現在のコンボ++;
                if (this.st叩ききりまショー.n現在のコンボ >= this.st叩ききりまショー.n最大コンボ)
                {
                    this.st叩ききりまショー.n最大コンボ = this.st叩ききりまショー.n現在のコンボ;
                }
                if (Math.Abs(nLagTime) > this.st叩ききりまショー.n最大ズレ時間)
                {
                    this.st叩ききりまショー.n最大ズレ時間 = Math.Abs(nLagTime);
                }
                if (Math.Abs(nLagTime) > this.st叩ききりまショー.n全体最大ズレ時間)
                {
                    this.st叩ききりまショー.n全体最大ズレ時間 = Math.Abs(nLagTime);
                }
                if (this.st叩ききりまショー.n最小ズレ時間 == -1)
                {
                    this.st叩ききりまショー.n最小ズレ時間 = Math.Abs(nLagTime);
                }
                if (Math.Abs(nLagTime) < this.st叩ききりまショー.n最小ズレ時間)
                {
                    this.st叩ききりまショー.n最小ズレ時間 = Math.Abs(nLagTime);
                }
                break;

            default:
                this.st叩ききりまショー.n現在のコンボ = 0;
                break;
            }
        }
コード例 #2
0
        // メソッド

        public void Start(EJudge judge, int lag, CDTX.CChip pChip, int player)
        {
            // When performing calibration, reduce visual distraction
            // and current judgment feedback near the judgment position.
            if (TJAPlayer3.IsPerformingCalibration)
            {
                return;
            }

            if (pChip.nチャンネル番号 >= 0x15 && pChip.nチャンネル番号 <= 0x19)
            {
                return;
            }


            for (int i = 0; i < 1; i++)
            {
                for (int j = 0; j < 12; j++)
                {
                    if (this.st状態[j].b使用中 == false)
                    {
                        this.st状態[j].ct進行    = new CCounter(0, 300, 1, TJAPlayer3.Timer);
                        this.st状態[j].b使用中    = true;
                        this.st状態[j].judge   = judge;
                        this.st状態[j].n相対X座標  = 0;
                        this.st状態[j].n相対Y座標  = 0;
                        this.st状態[j].n透明度    = 0xff;
                        this.st状態[j].nPlayer = player;
                        break;
                    }
                }
            }
        }
コード例 #3
0
        public virtual void Start(int nLane, EJudge judge, bool b両手入力, int nPlayer)
        {
            //2017.08.15 kairera0467 排他なので番地をそのまま各レーンの状態として扱う

            //for( int n = 0; n < 1; n++ )
            {
                this.st状態[nPlayer].ct進行    = new CCounter(0, 14, 20, TJAPlayer3.Timer);
                this.st状態[nPlayer].judge   = judge;
                this.st状態[nPlayer].nPlayer = nPlayer;

                switch (nLane)
                {
                case 0x11:
                case 0x12:
                    this.st状態[nPlayer].nIsBig = 0;
                    break;

                case 0x13:
                case 0x14:
                case 0x1A:
                case 0x1B:
                {
                    if (b両手入力)
                    {
                        this.st状態[nPlayer].nIsBig = 1;
                    }
                    else
                    {
                        this.st状態[nPlayer].nIsBig = 0;
                    }
                }
                break;
                }
            }
        }
コード例 #4
0
        public static void TestJudge()
        {
            Action action = (Action)(EHandler.CreateMethod <ENull>((il) =>
            {
                EMethod methodInfoHelper = typeof(Console);
                EVar Int_1 = 2;
                EVar Int_2 = 2;

                EArray objectArray = EArray.CreateArraySpecifiedLength <object>(2);
                objectArray.StoreArray(0, Int_1.InStackAndPacket);
                objectArray.StoreArray(1, Int_2.InStackAndPacket);

                EJudge.
                If(Int_1 > 2)(() =>
                {
                    EVar str = "{0}>{1}";
                    methodInfoHelper.ExecuteMethod <string, object[]>("WriteLine", str, objectArray);
                })
                .ElseIf(Int_1 == Int_2)(() =>
                {
                    EVar str = "{0}={1}";
                    methodInfoHelper.ExecuteMethod <string, object[]>("WriteLine", str, objectArray);
                })
                .Else(() =>
                {
                    EVar str = "{0}<{1}";
                    methodInfoHelper.ExecuteMethod <string, object[]>("WriteLine", str, objectArray);
                });
            }).Compile());

            action();
        }
コード例 #5
0
        // メソッド

        public virtual void Start(int nLane, EJudge judge, int player)
        {
            for (int j = 0; j < 3 * 4; j++)
            {
                if (!this.st状態[j].b使用中)
                //for( int n = 0; n < 1; n++ )
                {
                    this.st状態[j].b使用中 = true;
                    //this.st状態[ n ].ct進行 = new CCounter( 0, 9, 20, CDTXMania.Timer );
                    this.st状態[j].ct進行      = new CCounter(0, 6, 25, TJAPlayer3.Timer);
                    this.st状態[j].judge     = judge;
                    this.st状態[j].nPlayer   = player;
                    this.st状態_大[j].nPlayer = player;

                    switch (nLane)
                    {
                    case 0x11:
                    case 0x12:
                        this.st状態[j].nIsBig = 0;
                        break;

                    case 0x13:
                    case 0x14:
                    case 0x1A:
                    case 0x1B:
                        this.st状態_大[j].ct進行   = new CCounter(0, 9, 20, TJAPlayer3.Timer);
                        this.st状態_大[j].judge  = judge;
                        this.st状態_大[j].nIsBig = 1;
                        break;
                    }
                    break;
                }
            }
        }
コード例 #6
0
ファイル: SqlDynamicCache.cs プロジェクト: q760986433/NHulk
        /// <summary>
        /// 使用Natasha根据参数数组信息生成Command高速构建缓存
        /// </summary>
        /// <typeparam name="T">实际执行函数返回的类型</typeparam>
        /// <param name="sql">SQL语句</param>
        /// <param name="values">object参数数组</param>
        /// <returns>动态方法</returns>
        private static SqlDelegate <T> .GetCommandByObject GetEmitCommandCache <T>(string sql, object[] values)
        {
            Type returnType = typeof(T);

            if (!Cache.SqlCache.ContainsKey(returnType))
            {
                ModelAnalyser.Initialization(returnType);
            }

            Delegate newMethod = EHandler.CreateMethod <ERef <IDbCommand>, object[], ENull>((il) =>
            {
                EModel idbCommand = EModel.CreateModelFromParameter <IDbCommand>(0);
                idbCommand.UseRef();
                idbCommand.Set("CommandText", sql);

                EArray arrayArg       = EArray.CreateArrayFromParameter(1, typeof(object));
                EModel copyParameters = idbCommand.Load("Parameters");

                MatchCollection collection = ParameterRegex.Matches(sql);
                int length = collection.Count;
                for (int i = 0; i < length; i += 1)
                {
                    Type type = values[i].GetType();

                    string memberName = collection[i].Groups[1].Value;
                    copyParameters.Dup();
                    EModel copyParameter = EMethod.Load(idbCommand).ExecuteMethod("CreateParameter").Dup();
                    copyParameter.Set("ParameterName", "@".Append(memberName));
                    copyParameter.Dup().Set("DbType", (int)SqlTypes[type]);

                    if (type.IsPrimitive)
                    {
                        copyParameter.Dup().Set("Value", () => { arrayArg.LoadArray(i); });
                    }
                    else
                    {
                        EJudge.If(ENull.IsNull(() => { arrayArg.LoadArray(i); }))(() =>
                        {
                            copyParameter.Dup().Set("Value", EDBNull.LoadValue);
                        }).Else(() =>
                        {
                            copyParameter.Dup().Set("Value", () => { arrayArg.LoadArray(i); });
                        });
                    }
                    EMethod.Load <IList>().ExecuteMethod <object>("Add").Pop();
                }
                copyParameters.Pop();
            }).Compile(typeof(SqlDelegate <T> .GetCommandByObject));

            return((SqlDelegate <T> .GetCommandByObject)newMethod);
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: wcfylcf/Natasha
        public static void TestIf()
        {
            Delegate showResult = EHandler.CreateMethod <ENull>((il) =>
            {
                EMethod method = typeof(Console);

                EVar emit_A = EVar.CreateWithoutTempVar(10);
                EVar emit_B = EVar.CreateVarFromObject(20);

                TestClass t = new TestClass()
                {
                    Field = 10
                };
                t.PropertyName = "3";
                EModel model   = EModel.CreateModelFromObject(t);

                EJudge.If(emit_A == model.DLoadValue("Field").Operator)(() =>
                {
                    method.ExecuteMethod <string>("WriteLine", "相等");
                }).ElseIf(emit_A > emit_B)(() =>
                {
                    method.ExecuteMethod <int>("WriteLine", emit_A);
                }).Else(() =>
                {
                    method.ExecuteMethod <int>("WriteLine", emit_B);
                });



                EVar string_A = "6";
                EVar string_B = "2";

                EJudge.If(string_A == "1")(() =>
                {
                    method.ExecuteMethod <string>("WriteLine", string_A);
                }).ElseIf(string_A == model.DLoadValue("PropertyName").Operator)(() =>
                {
                    method.ExecuteMethod <string>("WriteLine", string_A);
                }).Else(() =>
                {
                    method.ExecuteMethod <string>("WriteLine", string_B);
                });
            }).Compile();

            ((Action)showResult)();
        }
コード例 #8
0
        public static void TestDefault()
        {
            Action action = (Action)(EHandler.CreateMethod <ENull>((il) =>
            {
                EMethod methodInfoHelper = typeof(Console);
                EVar stringHandler = "16";
                EVar intHandler = 10;
                EVar doubleHandler = 0.00;
                EJudge.If(EDefault.IsDefault(doubleHandler.TypeHandler, () => { doubleHandler.Load(); }))(() =>
                {
                    EMethod.Load(typeof(Console)).ExecuteMethod <string>("WriteLine", "doubleHandler是默认值");
                }).Else(() =>
                {
                    doubleHandler.This();
                    methodInfoHelper.ExecuteMethod <double>("WriteLine");
                });
            }).Compile());

            action();
        }
コード例 #9
0
ファイル: EStruckCheck.cs プロジェクト: wcfylcf/Natasha
        public static void Create(Type TypeHandler)
        {
            Delegate func = EHandler.CreateMethod <object, bool>((il) =>
            {
                LocalBuilder builder = il.DeclareLocal(TypeHandler);
                il.REmit(OpCodes.Ldarg_0);
                il.REmit(OpCodes.Unbox_Any, TypeHandler);
                il.REmit(OpCodes.Stloc_S, builder);

                EVar returnTrueResult  = true;
                EVar returnFalseResult = false;


                EModel model = EModel.CreateModelFromBuilder(builder, TypeHandler);
                #region Property
                Dictionary <string, PropertyInfo> properties = model.Struction.Properties;
                foreach (var item in properties)
                {
                    DebugHelper.WriteLine("检测" + item.Key + "是否为默认值:");
                    Type type = item.Value.PropertyType;
                    if (type.IsValueType && type.IsPrimitive)
                    {
                        EJudge.If(EDefault.IsDefault(type, () => { model.LPropertyValue(item.Key); }))(() =>
                        {
                        }).Else(() =>
                        {
                            MethodHelper.ReturnValue(false);
                        });
                    }
                    else if (type.IsClass)
                    {
                        EJudge.If(ENull.IsNull(() => { model.LPropertyValue(item.Key); }))(() =>
                        {
                        }).Else(() =>
                        {
                            MethodHelper.ReturnValue(false);
                        });
                    }
                }
                #endregion
                #region Fields
                Dictionary <string, FieldInfo> fields = model.Struction.Fields;
                foreach (var item in fields)
                {
                    DebugHelper.WriteLine("检测" + item.Key + "是否为默认值:");
                    Type type = item.Value.FieldType;
                    if (type.IsValueType && type.IsPrimitive)
                    {
                        EJudge.If(EDefault.IsDefault(type, model.DLoadValue(item.Key).DelayAction))(() =>
                        {
                        }).Else(() =>
                        {
                            MethodHelper.ReturnValue(false);
                        });
                    }
                    else if (type.IsClass)
                    {
                        EJudge.If(ENull.IsNull(model.DLoadValue(item.Key).DelayAction))(() =>
                        {
                        }).Else(() =>
                        {
                            MethodHelper.ReturnValue(false);
                        });
                    }
                }
                #endregion
                il.EmitBoolean(true);
            }, "Check").Compile(typeof(CheckStructDelegate));

            ClassCache.CheckStructDict[TypeHandler] = (CheckStructDelegate)func;
        }
コード例 #10
0
        };         //おおよその値。

        // ----------------------------------
        #endregion

        public void Damage(int nHitCourse, EJudge e今回の判定, int nPlayer)        //2020.04.25 Mr-Ojii akasoko26さんのコードをもとに変更
        {
            float fDamage;
            //現在のコースを当てるのではなくヒットしたノーツのコースを当ててあげる.2020.04.21.akasoko26
            var nコース = nHitCourse;


            switch (e今回の判定)
            {
            case EJudge.Perfect:
            case EJudge.Great:
            {
                if (TJAPlayer3.DTX[nPlayer].bHasBranchChip)
                {
                    fDamage = this.dbゲージ増加量_Branch[nPlayer, nコース, 0];
                }
                else
                {
                    fDamage = this.dbゲージ増加量[nPlayer, 0];
                }
            }
            break;

            case EJudge.Good:
            {
                if (TJAPlayer3.DTX[nPlayer].bHasBranchChip)
                {
                    fDamage = this.dbゲージ増加量_Branch[nPlayer, nコース, 1];
                }
                else
                {
                    fDamage = this.dbゲージ増加量[nPlayer, 1];
                }
            }
            break;

            case EJudge.Poor:
            case EJudge.Miss:
            {
                if (TJAPlayer3.DTX[nPlayer].bHasBranchChip)
                {
                    fDamage = this.dbゲージ増加量_Branch[nPlayer, nコース, 2];
                }
                else
                {
                    fDamage = this.dbゲージ増加量[nPlayer, 2];
                }


                if (fDamage >= 0)
                {
                    fDamage = -fDamage;
                }

                if (this.bRisky)
                {
                    this.nRiskyTimes--;
                }
            }

            break;

            default:
            {
                if (nPlayer == 0 ? TJAPlayer3.ConfigIni.b太鼓パートAutoPlay[0] : TJAPlayer3.ConfigIni.b太鼓パートAutoPlay[1])
                {
                    if (TJAPlayer3.DTX[nPlayer].bHasBranchChip)
                    {
                        fDamage = this.dbゲージ増加量_Branch[nPlayer, nコース, 0];
                    }
                    else
                    {
                        fDamage = this.dbゲージ増加量[nPlayer, 0];
                    }
                }
                else
                {
                    fDamage = 0;
                }
                break;
            }
            }


            this.db現在のゲージ値[nPlayer] = Math.Round(this.db現在のゲージ値[nPlayer] + fDamage, 5, MidpointRounding.ToEven);

            if (this.db現在のゲージ値[nPlayer] >= 100.0)
            {
                this.db現在のゲージ値[nPlayer] = 100.0;
            }
            else if (this.db現在のゲージ値[nPlayer] <= 0.0)
            {
                this.db現在のゲージ値[nPlayer] = 0.0;
            }
        }
コード例 #11
0
ファイル: SqlDynamicCache.cs プロジェクト: q760986433/NHulk
        /// <summary>
        /// 使用Natasha根据实例信息生成Command高速构建缓存,由参数类型以及SQL字符串决定缓存存储
        /// </summary>
        /// <typeparam name="T">Command缓存方法中需要传入实例类型</typeparam>
        /// <param name="sql">SQL语句</param>
        /// <param name="value">实例</param>
        /// <returns>动态方法</returns>
        private static SqlDelegate <T> .GetGenericCommand GetEmitCommandGenericCache <T>(string sql, T value)
        {
            Type returnType = typeof(T);

            if (!Cache.SqlCache.ContainsKey(returnType))
            {
                ModelAnalyser.Initialization(returnType);
            }

            Delegate newMethod = EHandler.CreateMethod <ERef <IDbCommand>, T, ENull>((il) =>
            {
                EModel idbCommand = EModel.CreateModelFromParameter <IDbCommand>(0);
                idbCommand.UseRef();
                idbCommand.Set("CommandText", sql);

                MatchCollection collection = ParameterRegex.Matches(sql);
                int i_length = collection.Count;

                if (i_length > 0)
                {
                    Type type        = value.GetType();
                    EModel valueDate = EModel.CreateModelFromParameter <T>(1);

                    if (!Cache.SqlCache.ContainsKey(type))
                    {
                        ModelAnalyser.Initialization(type);
                    }
                    EModel copyParameters = idbCommand.Load("Parameters");
                    IDictionary <string, Type> typeCache = Cache.StructionCache[type].ModelTypeCache;
                    for (int i = 0; i < i_length; i += 1)
                    {
                        string memberName = collection[i].Groups[1].Value;
                        Type tempType     = typeCache[memberName];

                        copyParameters.Dup();                                                                       //+ Stack:[IDbCommand.Parameters] [IDbCommand.Parameters]
                        EModel copyParameter = EMethod.Load(idbCommand).ExecuteMethod("CreateParameter").Dup();     //+ Stack:[IDbCommand.Parameters] [IDbCommand.Parameters] [IDbParameter] [IDbParameter]
                        copyParameter.Set("ParameterName", "@".Append(memberName));                                 //+ Stack:[IDbCommand.Parameters] [IDbCommand.Parameters] [IDbParameter]                        Deal:([IDbParameter].ParameterName=@XXX)
                        copyParameter.Dup().Set("DbType", (int)SqlTypes[tempType]);                                 //+ Stack:[IDbCommand.Parameters] [IDbCommand.Parameters] [IDbParameter]                        Deal:([IDbParameter].DbType=XXX)
                        copyParameter.Dup().Set("Value", () =>
                        {
                            if (il.IsNullable(tempType))
                            {
                                EJudge.If(valueDate.DLoad(memberName).DLoadValue("HasValue").DelayAction)(() =>
                                {
                                    valueDate.Load(memberName).LoadValue("Value").Packet();
                                }).Else(() =>
                                {
                                    EDBNull.LoadValue();
                                });
                            }
                            else if (tempType.IsValueType)
                            {
                                valueDate.Load(memberName).Packet();
                            }
                            else
                            {
                                EJudge.If(ENull.IsNull(valueDate.DLoad(memberName).DelayAction))(() =>
                                {
                                    EDBNull.LoadValue();
                                }).Else(() =>
                                {
                                    valueDate.Load(memberName).Packet();
                                });
                            }
                        });                                                         //+ Stack:[IDbCommand.Parameters] [IDbCommand.Parameters] [IDbParameter]                        Deal:([IDbParameter].Value=XXX)
                        EMethod.Load <IList>().ExecuteMethod <object>("Add").Pop(); //+ Stack:[IDbCommand.Parameters]                                                               Deal:Add([IDbCommand.Parameters] [IDbParameter])
                    }
                    copyParameters.Pop();
                }
            }).Compile(typeof(SqlDelegate <T> .GetGenericCommand));

            return((SqlDelegate <T> .GetGenericCommand)newMethod);
        }
コード例 #12
0
ファイル: SqlDynamicCache.cs プロジェクト: q760986433/NHulk
        /// <summary>
        /// 获取Reader映射缓存方法
        /// </summary>
        /// <typeparam name="T">返回的类型</typeparam>
        /// <param name="reader">数据库返回的DataReader</param>
        /// <param name="sql">SQL语句</param>
        /// <returns>动态缓存方法</returns>
        private static SqlDelegate <T> .GetReaderInstance GetEmitReaderCache <T>(IDataReader reader, int startIndex, int length)
        {
            Type returnType = typeof(T);

            if (!Cache.SqlCache.ContainsKey(returnType))
            {
                ModelAnalyser.Initialization(returnType);
            }
            SqlModel sqlModel = Cache.SqlCache[returnType];

            Delegate dynamicMethod = EHandler.CreateMethod <IDataReader, T>((il) =>
            {
                EMethod dataHandler = typeof(IDataRecord);
                EVar parameterVar   = EVar.CreateVarFromParameter <IDataRecord>(0);

                if (returnType == typeof(object) || returnType == typeof(string) || returnType == typeof(byte[]) || (returnType.IsValueType && returnType.IsPrimitive) || il.IsNullable(returnType))
                {
                    if (returnType.IsValueType && returnType.IsPrimitive)
                    {
                        LoadStrongTypeValue(returnType, parameterVar, startIndex);
                    }
                    else
                    {
                        EJudge.If(() => { EMethod.Load(parameterVar).ExecuteMethod <int>("IsDBNull", startIndex); })(() =>
                        {
                            if (il.IsNullable(returnType))
                            {
                                EModel model = EModel.CreateModel(returnType).UseDefaultConstructor();
                                model.Load();
                            }
                            else
                            {
                                ENull.LoadNull();
                            }
                        }).Else(() =>
                        {
                            LoadStrongTypeValue(returnType, parameterVar, startIndex);
                        });
                    }
                }
                else
                {
                    EModel model = EModel.CreateModel <T>().UseDefaultConstructor();

                    for (int i = startIndex; i < startIndex + length; i += 1)
                    {
                        string tempName = sqlModel.GetRealName(reader.GetName(i));
                        Type type       = null;
                        if (!model.Struction.Properties.ContainsKey(tempName) && !model.Struction.Fields.ContainsKey(tempName))
                        {
                            continue;
                        }
                        else
                        {
                            type = sqlModel.Struction.ModelTypeCache[tempName];
                        }
                        if (type.IsValueType && type.IsPrimitive)
                        {
                            model.Set(tempName, () =>
                            {
                                LoadStrongTypeValue(type, parameterVar, i);
                            });
                        }
                        else
                        {
                            EJudge.IfTrue(() => { EMethod.Load(parameterVar).ExecuteMethod <int>("IsDBNull", i); })(() =>
                            {
                                model.Set(tempName, () =>
                                {
                                    LoadStrongTypeValue(type, parameterVar, i);
                                });
                            });
                        }
                    }
                    model.Load();
                }
            }).Compile(typeof(SqlDelegate <T> .GetReaderInstance));

            return((SqlDelegate <T> .GetReaderInstance)dynamicMethod);
        }