private void StartFuncMethod() { //WindowManager.Instance.HideAllWindow(); HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, m_CurrentStage.EnterFuncId, null); }
private void TriggerSceneState(MessageObject obj) { if (!(obj.msgValue is GameLogicSceneType)) { return; } var map = ConfigManager.Instance.GetLimitFuncSceneConfig(); if (null == map) { Debuger.Log("can't load limit func scene config "); return; } int sceneid = (int)(((GameLogicSceneType)(obj.msgValue))); foreach (var elem in map.LimitFuncSceneConfigMap) { if (elem.Key == sceneid) { for (int i = 0; i < elem.Value.Count; ++i) { HandleTarget target = HandleTarget.GetHandleTarget(null); if (LimitMethods.HandleLimitExec(target, elem.Value[i].LimitId, null)) { FuncMethods.HandleFuncExec(target, elem.Value[i].FuncId, null); } } } } }
private void StartResumeFuncMethod() { //WindowManager.Instance.HideAllWindow(); HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, WorldSceneDispatchController.Instance.GetParam().m_iExitSceneStep2FuncId, null); }
static public void InitFuncMethod() { //Func Array FuncExec = new List <FuncMethodsBase> { new Func_1_Flag(), new Func_2_Bit8(), new Func_3_Bit32(), new Func_5_AcceptMission(), new Func_6_PlayAction(), new Func_7_MissionCount(), new Func_8_MissionStepCount(), new Func_9_PlayBackgroundMusic(), new Func_10_PlayEffect(), new Func_11_CreateNpc(), new Func_12_DestroyNpc(), new Func_13_SetDictateGame(), new Func_14_ChangeToNodeGame(), new Func_15_ChangeToWorldGame(), new Func_16_UnlockStage(), }; FuncMethods.InitFuncMethods(FuncExec); FuncExec.Clear(); FuncExec = null; }
public void TriggerSceneState(GameLogicSceneType sceneType) { for (int i = 0; i < m_CurrentMissionStepList.Count; ++i) { MissionStepConfig elemStep = m_CurrentMissionStepList[i]; if (elemStep.SceneId == (int)(sceneType)) { HandleTarget target = HandleTarget.GetHandleTarget(null); if (LimitMethods.HandleLimitExec(target, elemStep.SceneLimitId, null)) { FuncMethods.HandleFuncExec(target, elemStep.SceneFuncId, null); } } HandleTarget target1 = HandleTarget.GetHandleTarget(null); if (LimitMethods.HandleLimitExec(target1, elemStep.CompleteLimitId, null)) { FuncMethods.HandleFuncExec(target1, elemStep.CompleteFuncId, null); } } bool isMissionComplete = false; HandleTarget target2 = HandleTarget.GetHandleTarget(null); if (LimitMethods.HandleLimitExec(target2, m_CurrentMission.CompleteLimitId, null)) { isMissionComplete = true; FuncMethods.HandleFuncExec(target2, m_CurrentMission.CompleteFuncId, null); } if (isMissionComplete) { m_OnMissioinComplete(this); } }
public void TryCreateDelegate_ClassWithFuncMethodWithParam_ReturnsTrue() { var obj = new FuncMethods(); var method = obj.GetType().GetMethod(nameof(obj.SomeParamFunc)); bool canCreate = method.TryCreateDelegate(obj, out Func<object, int> del); Assert.IsTrue(canCreate); }
private static void EmitProcessAndEncodeAsyncWithRetval(HandlerClassBuildingContext classContext, IEmittingContext emittingContext, Type pureRetvalType) { var encodeDeferredMethod = CreateEncodeDeferredMethod(classContext, pureRetvalType); var continueWithMethod = TaskMethods.ContinueWith(pureRetvalType, typeof(byte[])); var il = emittingContext.IL; il.Ldarg(0); il.Ldftn(encodeDeferredMethod); il.Newobj(FuncMethods.Constructor(typeof(Task <>).MakeGenericType(pureRetvalType), typeof(byte[]))); il.Callvirt(continueWithMethod); }
private void OnHitLife(MessageObject msg) { var transform = ((Transform)(msg.msgValue)); if (transform == m_CharTransformData.GetGameObject().transform) { // set high light //m_CharTransformData.SetSelectedStatus(true); //trigger npc hit function FuncMethods.HandleFuncExec(HandleTarget.GetHandleTarget(this), m_NpcBaseInfo.ClickFuncId, null); } else { //IsPlayerControlled = false; m_CharTransformData.SetSelectedStatus(false); } }
public void ExecuteExitNodeGame() { if (UIWindowSelectScene.m_iIndex != -1) { UIWindowSelectScene.OnExitFlightGame(); return; } if (m_ProcessData.m_iExitSceneFuncId != 0) { HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, m_ProcessData.m_iExitSceneFuncId, null); //m_ProcessData.m_iExitSceneFuncId = 0; } else { StageManager.Instance.ChangeState(GameStateType.SelectSceneState); } }
public void DrawCurves() { SequenceFunc t = (double x, int kk) => Math.Log(0.01 + (x + 1 - 0.1 * kk).Sqr());//1.0/(1.0+kk*x*x);//FuncMethods.Monoms; RealFunc[] f = new RealFunc[] { (double x) => Math.Exp(x / (x.Abs() + 1)), (double x) => Math.Sin(x + 2) * Math.Cos(2 * x), (double x) => x.Abs() * Math.Exp(Math.Cos(x)), (double x) => Math.Log(1 + x.Abs()) * Math.Sinh(x / 2), (double x) => Math.Sin(x) - 8.0 / (2 * x + 6), (double x) => x.Abs() + Math.Log(0.01 + x * x) }; Point[] b = new Point[] { new Point(0, 5), new Point(-4, 4), new Point(-2, 4), new Point(-2, 2), new Point(-1, 1), new Point(-1, 1) }; int k = 64; int[] mas = new int[k]; for (int i = 0; i < k; i++) { mas[i] = i + 1; } Parallel.For(0, f.Length, (int i) => { var c = FuncMethods.UltraVsNormal(f[i], t, SequenceFuncKind.Other, k, b[i].x, b[i].y); StreamWriter fs = new StreamWriter($"Monoms {i + 1}.txt"); fs.WriteLine($"count normal ultra"); for (int j = 0; j < k; j++) { fs.WriteLine($"{mas[j]} {c.Item1[j]} {c.Item2[j]}"); } fs.Close(); }); //k = 75; //mas = new int[k]; //for (int i = 0; i < k; i++) // mas[i] = i + 1; //Parallel.For(0, f.Length, (int i) => //{ // t = FuncMethods.TrigSystem(b[i].x, b[i].y); // var c = FuncMethods.UltraVsNormal(f[i], t, SequenceFuncKind.Orthogonal, k, b[i].x, b[i].y); // StreamWriter fs = new StreamWriter($"Trig {i + 1}.txt"); // fs.WriteLine($"count normal ultra"); // for (int j = 0; j < k; j++) // fs.WriteLine($"{mas[j]} {c.Item1[j]} {c.Item2[j]}"); // fs.Close(); //}); }
private void EmitProcessAsyncWithRetval(ProxyClassBuildingContext classContext, IEmittingContext emittingContext, string parameterMethodName, IReadOnlyList <Type> genericTypeArguments, Type retvalType) { var pureRetvalType = retvalType.GetGenericArguments().Single(); var decodeDeferredMethod = CreateDecodeDeferredMethod(classContext, parameterMethodName, genericTypeArguments, pureRetvalType); if (decodeDeferredMethod.IsGenericMethodDefinition) { decodeDeferredMethod = decodeDeferredMethod.MakeGenericMethod(genericTypeArguments.ToArray()); } var funcConstructor = FuncMethods.Constructor(typeof(Task <byte[]>), pureRetvalType); var continueWithMethod = TaskMethods.ContinueWith(typeof(byte[]), pureRetvalType); var il = emittingContext.IL; il.Callvirt(OutgoingRequestProcessorMethods.ProcessAsync); il.Ldarg(0); il.Ldftn(decodeDeferredMethod); il.Newobj(funcConstructor); il.Callvirt(continueWithMethod); }
public void DrawCurves2() { SequenceFunc t = (double x, int k) => Math.Exp(k * x);//FuncMethods.Monoms; int[] count = new int[] { 9, 16, 34 }; RealFunc[] f = new RealFunc[count.Length]; Point[] b = new Point[] { new Point(-1, 5), new Point(-4, 4), new Point(-2, 4), new Point(-2, 2), new Point(-1, 1), new Point(-1, 1) }; RealFunc f1 = (double x) => Math.Cos(2 * x) * (Math.Exp((x / 3).Abs()) - 4 * Math.Log(1 + x.Abs()));//Math.Sin(5 * x) / Math.Exp(x.Abs() / 3); RealFunc fl; Parallel.For(0, f.Length, (int i) => { f[i] = FuncMethods.Approx(f1, t, SequenceFuncKind.Other, count[i], b[0].x, b[0].y, true); }); fl = FuncMethods.Approx(f1, t, SequenceFuncKind.Other, count[count.Length - 1], b[0].x, b[0].y); int c = 280; double h = (b[0].y - b[0].x) / (c - 1); StreamWriter fs = new StreamWriter($"Monoms vs.txt"); //fs.WriteLine($"count normal ultra"); for (int j = 0; j < c; j++) { double arg = b[0].x + j * h; fs.Write($"{arg} {f1(arg)} {fl(arg)}"); for (int i = 0; i < count.Length; i++) { fs.Write($" {f[i](arg)}"); } fs.WriteLine(); } fs.Close(); }
private void OnTrigger() { //try get target var param = m_ActionPlayer.GetActionParam(); if (null != param && null != param.Object && param.Object is FuncContext) { FuncContext context = param.Object as FuncContext; if (!context.ContainsKey(FuncContext.ContextKey.LimitId) || !context.ContainsKey(FuncContext.ContextKey.FunctionId)) { return; } int limitId = (int)(context.Get(FuncContext.ContextKey.LimitId)); int funcId = (int)(context.Get(FuncContext.ContextKey.LimitId)); HandleTarget target = null; Ilife user = context.Get(FuncContext.ContextKey.User) as Ilife; if (context.ContainsKey(FuncContext.ContextKey.Target)) { //locked skill target = HandleTarget.GetHandleTarget(user, context.Get(FuncContext.ContextKey.Target) as Ilife); } else { //target is null,unlocked skill int targetId = (int)(context.Get(FuncContext.ContextKey.TargetId)); target = TargetMethods.GetTargetList(user, targetId, null); } //exec attack if (LimitMethods.HandleLimitExec(target, limitId, null)) { FuncMethods.HandleFuncExec(target, funcId, null); } } }
private void DoEnterScene() { HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, m_CurrentStage.EnterFuncId, null); }
private void OnSceneWin() { HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, m_CurrentStage.WinLimitId, null); }
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < 9; i++) { Program.FORM.chart1.Series[i].Points.Clear(); } for (int i = 0; i < chart1.Series.Count; i++) { chart1.Series[i].IsVisibleInLegend = false; } for (int i = 9; i < Program.FORM.chart1.Series.Count; i++) { Program.FORM.chart1.Series.RemoveAt(i); i--; } Func <double, double> f = Math.Sin; FuncMethods.NetFunc net = new FuncMethods.NetFunc(); Func <double, double> g1, g2, g3, g4, g5, g6, g7; //SequenceFunc Monom, Leg, Cheb, Lager, Her, Trig, Har; g1 = g2 = g3 = g4 = g5 = g6 = g7 = null; //определить действительную функцию if (radioButton5.Checked) { f = (double x) => (Math.Cos(x) - 1); } if (radioButton6.Checked) { f = (double x) => (Math.Abs(x - 1)); } if (radioButton7.Checked) { f = (double x) => (Math.Exp(x - x * x)); } if (radioButton8.Checked) { f = (double x) => (Math.Exp(x) / (Math.Abs(x) + 1)); } if (radioButton9.Checked) { f = (double x) => (x * Math.Sin(x) / (Math.Abs(x) + 2)); } if (radioButton10.Checked) { f = (double x) => (x / (1 + x * x)); } if (radioButton11.Checked) { f = (double x) => (x * Math.Cos(x)); } if (radioButton12.Checked) { f = (double x) => (Math.Log(1 + Math.Abs(x))); } if (radioButton13.Checked) { f = (double x) => (x * x * x + x - 4); } if (radioButton14.Checked) { f = (double x) => (3); } if (radioButton15.Checked) { f = (double x) => (2 * x - Math.Exp(-x)); } if (radioButton16.Checked) { string s = textBox7.Text; try { f = Parser.GetDelegate(s); textBox7.Text = Parser.FORMULA; } catch { f = (double x) => 0; } } chart1.Series[0].IsVisibleInLegend = true; FileStream fs = new FileStream("Данные об аппроксимации.txt", FileMode.Create); TextWriter tmp = Console.Out; StreamWriter sw = new StreamWriter(fs); Console.SetOut(sw); const string message = "Все доступные поля должны быть заполнены действительными числами. Число шагов и число отрезков - натуральными числами. При записи действительных чисел используются запятые, а не точки. Количество заверенных точек должно быть не больше количества действительно заданных точек."; const string caption = "Неверные входные данные!"; try { int n1 = Convert.ToInt32(numericUpDown1.Value), n2 = Convert.ToInt32(numericUpDown2.Value); double[,] MAS = new double[chart1.Series.Count, n2 + 1]; //определить сеточную функцию if (!radioButton1.Checked) { double a = Convert.ToDouble(textBox1.Text), b = Convert.ToDouble(textBox2.Text); int n = Convert.ToInt16(textBox6.Text), ccount = Convert.ToInt32(numericUpDown3.Value); double h = (b - a) / (ccount - 1); Point[] mas1, mas2, mas3 = new Point[ccount]; for (int i = 0; i < ccount; i++) { mas3[i] = new Point(a + i * h, f(a + i * h)); } //чтение набора узлов int m = Convert.ToInt32(textBox4.Text); mas2 = new МатКлассы.Point[m]; string s; string[] st; for (int k = 0; k < m; k++) { s = textBox5.Lines[k]; st = s.Split(' ');//в аргументах указывается массив символов, которым разделяются числа mas2[k] = new МатКлассы.Point(Convert.ToDouble(st[0]), Convert.ToDouble(st[1])); } //чтение массива абцисс s = textBox3.Lines[0]; st = s.Split(' ');//в аргументах указывается массив символов, которым разделяются числа; m = st.Length; mas1 = new МатКлассы.Point[m]; for (int k = 0; k < m; k++) { double v = Convert.ToDouble(st[k]); mas1[k] = new МатКлассы.Point(v, f(v)); } if (radioButton2.Checked) { net = new FuncMethods.NetFunc(mas1); } else { net = new FuncMethods.NetFunc(mas2); } if (checkBox10.Checked) { net = new FuncMethods.NetFunc(mas3); } a = net.MinArg; b = net.MaxArg; if (checkBox9.Checked) { for (n = n1; n <= n2; n++) { Matrix O = new Matrix(MAS); O.PrintMatrix(); "".Show(); if (checkBox1.Checked) { SequenceFunc t = FuncMethods.Monoms; Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Other, n); if (radioButton2.Checked) { MAS[1, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); } else { MAS[1, n] = FuncMethods.NetFunc.Distance(net, g); } chart1.Series[1].Points.AddXY(n, Math.Log10(MAS[1, n])); chart1.Series[1].IsVisibleInLegend = true; } if (checkBox2.Checked) { SequenceFunc t = FuncMethods.Lezhandrs(a, b); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Orthogonal, n); if (radioButton2.Checked) { MAS[2, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); } else { MAS[2, n] = FuncMethods.NetFunc.Distance(net, g); } chart1.Series[2].Points.AddXY(n, Math.Log10(MAS[2, n])); chart1.Series[2].IsVisibleInLegend = true; } if (checkBox6.Checked) { SequenceFunc t = FuncMethods.TrigSystem(a, b); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Orthonormal, n); if (radioButton2.Checked) { MAS[6, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); } else { MAS[6, n] = FuncMethods.NetFunc.Distance(net, g); } chart1.Series[6].Points.AddXY(n, Math.Log10(MAS[6, n])); chart1.Series[6].IsVisibleInLegend = true; } if (checkBox7.Checked) { SequenceFunc t = FuncMethods.HaarSystem(a, b); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Orthogonal, n); if (radioButton2.Checked) { MAS[7, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); } else { MAS[7, n] = FuncMethods.NetFunc.Distance(net, g); } chart1.Series[7].Points.AddXY(n, Math.Log10(MAS[7, n])); chart1.Series[7].IsVisibleInLegend = true; } if (checkBox8.Checked) { SequenceFunc t = (double x, int k) => Math.Exp(k * x); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Other, n); if (radioButton2.Checked) { MAS[8, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); } else { MAS[8, n] = FuncMethods.NetFunc.Distance(net, g); } chart1.Series[8].Points.AddXY(n, Math.Log10(MAS[8, n])); chart1.Series[8].IsVisibleInLegend = true; } } } else//если рисуется не график зависимости от числа функций { if (radioButton2.Checked) { net = new FuncMethods.NetFunc(mas1); Draw_mas(mas1, Color.Blue); } else { net = new FuncMethods.NetFunc(mas2); Draw_mas(mas2, Color.Blue); } if (checkBox10.Checked) { net = new FuncMethods.NetFunc(mas3); Draw_mas(mas3, Color.Blue); } a = net.MinArg; b = net.MaxArg; //ShowPoints(net);//показать точки на графике if (checkBox1.Checked) { SequenceFunc t = FuncMethods.Monoms; //SequencePol t = FuncMethods.Monom; Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Other, n); chart1.Series[1].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[1].IsVisibleInLegend = true; Console.WriteLine("--------Для системы мономов---------"); if (radioButton2.Checked) { FuncMethods.ShowApprox(f, net.Arguments, t, SequenceFuncKind.Other, n); } else { FuncMethods.ShowApprox(net, t, SequenceFuncKind.Other, n); } } //Наименьшие перпендикуляры if (n == 2) { double a0 = 0, a1 = 0; double dist = 0, distold = 0;; SLAU S = new SLAU(2); for (int i = 0; i < net.CountKnots; i++) { S.A[0, 0] += net.Arg(i); S.A[1, 0] += net.Arg(i) * net[i]; S.A[1, 1] += net[i]; S.b[1] -= net[i] * net[i]; } S.A[0, 1] = net.CountKnots; S.b[0] = -S.A[1, 1]; //S.Show(); S.GaussSelection(); a1 = S.x[0]; a0 = S.x[1]; Func <double, double> pol = new Polynom(new double[] { -a0, -a1 }).Value; SLAU T = new SLAU(FuncMethods.Monoms, net, n); T.Gauss();//T.Show(); for (int i = 0; i < net.CountKnots; i++) { dist += Math.Pow(a1 * net.Arg(i) + net[i] + a0, 2); distold += Math.Pow(T.x[1] * net.Arg(i) + net[i] + T.x[0], 2); } dist /= net.CountKnots; distold /= net.CountKnots; dist = Math.Sqrt(dist); distold = Math.Sqrt(distold); Console.WriteLine("\t(в среднеквадратичной норме перпендикуляров) равна {0}", distold); Program.FORM.chart1.Series.Add("Прямая с наилучшими перпендикулярами"); int count = Program.FORM.chart1.Series.Count - 1; Program.FORM.chart1.Series[count].Color = Color.Black; Program.FORM.chart1.Series[count].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; //Program.FORM.chart1.Series[count].IsVisibleInLegend = false; Program.FORM.chart1.Series[count].BorderWidth = 2; chart1.Series[count].Points.DataBindXY(МатКлассы.Point.PointsX(pol, 100, a, b), МатКлассы.Point.PointsY(pol, 100, a, b)); Console.WriteLine("--------Для наименьших перпендикуляров---------"); Console.WriteLine("Аппроксимация сеточной функции полученной функцией"); Console.WriteLine("\t(в дискретной среднеквадратичной норме) равна {0}", FuncMethods.NetFunc.Distance(net, pol)); Console.WriteLine("\t(в среднеквадратичной норме перпендикуляров) равна {0}", dist); } if (checkBox2.Checked) { SequenceFunc t = FuncMethods.Lezhandrs(a, b); //SequencePol t = FuncMethods.Lezhandr(a, b); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Orthogonal, n); chart1.Series[2].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[2].IsVisibleInLegend = true; Console.WriteLine("--------Для системы полиномов Лежандра---------"); if (radioButton2.Checked) { FuncMethods.ShowApprox(f, net.Arguments, t, SequenceFuncKind.Orthogonal, n); } else { FuncMethods.ShowApprox(net, t, SequenceFuncKind.Orthogonal, n); } } if (checkBox6.Checked) { SequenceFunc t = FuncMethods.TrigSystem(a, b); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Orthonormal, n); chart1.Series[6].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[6].IsVisibleInLegend = true; Console.WriteLine("--------Для ортонормированной системы тригонометрических полиномов---------"); if (radioButton2.Checked) { FuncMethods.ShowApprox(f, net.Arguments, t, SequenceFuncKind.Orthonormal, n); } else { FuncMethods.ShowApprox(net, t, SequenceFuncKind.Orthonormal, n); } } if (checkBox7.Checked) { SequenceFunc t = FuncMethods.HaarSystem(a, b); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Orthogonal, n); chart1.Series[7].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[7].IsVisibleInLegend = true; Console.WriteLine("--------Для системы Хаара---------"); if (radioButton2.Checked) { FuncMethods.ShowApprox(f, net.Arguments, t, SequenceFuncKind.Orthogonal, n); } else { FuncMethods.ShowApprox(net, t, SequenceFuncKind.Orthogonal, n); } } if (checkBox8.Checked) { SequenceFunc t = (double x, int k) => Math.Exp(k * x); Func <double, double> g = FuncMethods.Approx(net, t, SequenceFuncKind.Other, n); chart1.Series[8].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[8].IsVisibleInLegend = true; Console.WriteLine("--------Для системы экспонент---------"); if (radioButton2.Checked) { FuncMethods.ShowApprox(f, net.Arguments, t, SequenceFuncKind.Other, n); } else { FuncMethods.ShowApprox(net, t, SequenceFuncKind.Other, n); } } } } else { double a = Convert.ToDouble(textBox1.Text), b = Convert.ToDouble(textBox2.Text); int n = Convert.ToInt16(textBox6.Text); if (checkBox9.Checked) { chart1.Series[0].Name = "Функция по системе Хаара, выраженная без учёта ортогональности этой системы"; chart1.Series[0].IsVisibleInLegend = true; for (n = n1; n <= n2; n++) { if (checkBox1.Checked) { //SequenceFunc t = FuncMethods.Monoms; SequencePol t = FuncMethods.Monom; Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); MAS[1, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); chart1.Series[1].Points.AddXY(n, Math.Log10(MAS[1, n])); chart1.Series[1].IsVisibleInLegend = true; chart1.Series[1].Name = "Мономы с применением ультра-гибрида"; //g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b, false); //MAS[0, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); //chart1.Series[0].Points.AddXY(n, Math.Log10(MAS[0, n])); //chart1.Series[0].IsVisibleInLegend = true; } if (checkBox2.Checked) { //SequenceFunc t = FuncMethods.Lezhandrs(a,b); SequencePol t = FuncMethods.Lezhandr(a, b); Polynom s = new Polynom(new double[] { -2 * a / (b - a) - 1, 2.0 / (b - a) }); Func <double, double>[] MyMas = new Func <double, double> [n]; for (int i = 0; i < n; i++) { MyMas[i] = /*Polynom.Lezh(i).Value;*/ Polynom.Lezh(i).Value(s).Value; } //Func<double,double> g = FuncMethods.ApproxForLezhandr(f, MyMas, a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Orthogonal, n, a, b); MAS[2, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); chart1.Series[2].Points.AddXY(n, Math.Log10(MAS[2, n])); chart1.Series[2].IsVisibleInLegend = true; } if (checkBox6.Checked) { SequenceFunc t = FuncMethods.TrigSystem(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Orthonormal, n, a, b); MAS[6, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); chart1.Series[6].Points.AddXY(n, Math.Log10(MAS[6, n])); chart1.Series[6].IsVisibleInLegend = true; chart1.Series[6].Name = "Тригонометрическая система с применением ультра-гибрида"; //g = FuncMethods.Approx(f, t, SequenceFuncKind.Orthonormal, n, a, b, false); //MAS[0, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); //chart1.Series[0].Points.AddXY(n, Math.Log10(MAS[0, n])); //chart1.Series[0].IsVisibleInLegend = true; } if (checkBox7.Checked) { SequenceFunc t = FuncMethods.HaarSystem(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Orthogonal, n, a, b); MAS[7, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); chart1.Series[7].Points.AddXY(n, Math.Log10(MAS[7, n])); chart1.Series[7].IsVisibleInLegend = true; chart1.Series[7].Name = "Система Хаара как ортогональная система"; //g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b, false); //MAS[0, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); //chart1.Series[0].Points.AddXY(n, Math.Log10(MAS[0, n])); //chart1.Series[0].IsVisibleInLegend = true; } if (checkBox8.Checked) { SequenceFunc t = (double x, int k) => Math.Exp(k * x); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); MAS[8, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); chart1.Series[8].Points.AddXY(n, Math.Log10(MAS[8, n])); chart1.Series[8].IsVisibleInLegend = true; chart1.Series[8].Name = "Экспоненты с применением ультра-гибрида"; //g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b, false); //MAS[0, n] = FuncMethods.RealFuncMethods.NormDistance(f, g, a, b); //chart1.Series[0].Points.AddXY(n, Math.Log10(MAS[0, n])); //chart1.Series[0].IsVisibleInLegend = true; } } Analys(MAS, n1, n2); } else { chart1.Series[0].Points.DataBindXY(МатКлассы.Point.PointsX(f, 100, a, b), МатКлассы.Point.PointsY(f, 100, a, b)); if (checkBox1.Checked) { //SequenceFunc t = FuncMethods.Monoms; SequencePol t = FuncMethods.Monom; Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); chart1.Series[1].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[1].IsVisibleInLegend = true; Console.WriteLine("--------Для системы мономов---------"); FuncMethods.ShowApprox(f, t, SequenceFuncKind.Other, n, a, b); } if (checkBox2.Checked) { //SequenceFunc t = FuncMethods.Lezhandrs(a,b); SequencePol t = FuncMethods.Lezhandr(a, b); Polynom s = new Polynom(new double[] { -2 * a / (b - a) - 1, 2.0 / (b - a) }); Func <double, double>[] MyMas = new Func <double, double> [n]; for (int i = 0; i < n; i++) { MyMas[i] = /*Polynom.Lezh(i).Value;*/ Polynom.Lezh(i).Value(s).Value; } Func <double, double> g = FuncMethods.ApproxForLezhandr(f, MyMas, a, b); chart1.Series[2].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[2].IsVisibleInLegend = true; Console.WriteLine("--------Для системы полиномов Лежандра---------"); FuncMethods.ShowApprox(f, t, SequenceFuncKind.Orthogonal, n, a, b); } if (checkBox3.Checked) { //SequencePol t = FuncMethods.Cheb(a,b); SequenceFunc t = FuncMethods.Chebs(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); chart1.Series[3].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[3].IsVisibleInLegend = true; } if (checkBox4.Checked) { SequenceFunc t = FuncMethods.Lagerrs(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); chart1.Series[4].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[4].IsVisibleInLegend = true; } if (checkBox5.Checked) { SequenceFunc t = FuncMethods.Hermits(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); chart1.Series[5].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[5].IsVisibleInLegend = true; } if (checkBox6.Checked) { SequenceFunc t = FuncMethods.TrigSystem(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Orthonormal, n, a, b); chart1.Series[6].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[6].IsVisibleInLegend = true; Console.WriteLine("--------Для ортонормированной системы тригонометрических полиномов---------"); FuncMethods.ShowApprox(f, t, SequenceFuncKind.Orthonormal, n, a, b); } if (checkBox7.Checked) { SequenceFunc t = FuncMethods.HaarSystem(a, b); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Orthogonal, n, a, b); chart1.Series[7].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[7].IsVisibleInLegend = true; Console.WriteLine("--------Для системы Хаара---------"); FuncMethods.ShowApprox(f, t, SequenceFuncKind.Orthogonal, n, a, b); } if (checkBox8.Checked) { SequenceFunc t = (double x, int k) => Math.Exp(k * x); Func <double, double> g = FuncMethods.Approx(f, t, SequenceFuncKind.Other, n, a, b); chart1.Series[8].Points.DataBindXY(МатКлассы.Point.PointsX(g, 100, a, b), МатКлассы.Point.PointsY(g, 100, a, b)); chart1.Series[8].IsVisibleInLegend = true; Console.WriteLine("--------Для системы экспонент---------"); FuncMethods.ShowApprox(f, t, SequenceFuncKind.Other, n, a, b); } } } } catch { var MBSave = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { sw.Close(); Console.SetOut(tmp); Console.WriteLine("Запись завершена!"); Program.DATA.textBox1.Text = ""; StreamReader sr = new StreamReader("Данные об аппроксимации.txt"); string ss = ""; while (ss != null) { Program.DATA.textBox1.Text += ss + Environment.NewLine; ss = sr.ReadLine(); } sr.Close(); } }
public void TryPlaySkill(int id, Ilife user, Ilife lockedTarget = null) { SkillConfig config = ConfigManager.Instance.GetSkillConfig(id); if (null == config) { Debuger.Log("can't load skill id: " + id); return; } //check cd SkillCd cd = null; if (m_CdStore.TryGetValue(id, out cd)) { if (cd.cd > 0) { // can't play skill return; } } if (m_BeginCdStore.TryGetValue(id, out cd)) { if (cd.cd > 0) { // can't play skill return; } } if (m_PlayingSkill.ContainsKey(id)) { //can't play return; } //per handle HandleTarget target = HandleTarget.GetHandleTarget(user); if (LimitMethods.HandleLimitExec(target, config.PerLimitId, null)) { FuncMethods.HandleFuncExec(target, config.PerFuncId, null); m_LockedTargetList.Add(id, lockedTarget); if (config.BeginCd <= 0) { TriggerExecSkill(user, config); } else { if (m_BeginCdStore.ContainsKey(config.Id)) { m_BeginCdStore.Add(config.Id, new SkillCd(config.InitCd, config, user)); } else { m_BeginCdStore[config.Id] = new SkillCd(config.InitCd, config, user); } } } }
protected void OnSceneLose() { HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, m_CurrentStage.LoseFuncId, null); }
public EllipseParam[] GetEllipses(string[] array, double ts) { EllipseParam[] param = new EllipseParam[array.Length]; double sd = textBox6.Text.ToDouble(); Parallel.For(0, array.Length, (int i) => { string[] st = array[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var Vgb = (st[4].ToDouble(), st[5].ToDouble()); double s = Vgb.Item1 * (Vgb.Item2 - ts /*(2.5*st[10].ToDouble()+5e-5)*/); param[i] = new EllipseParam(new Point(st[0].ToDouble(), st[1].ToDouble()), new Point(st[2].ToDouble(), st[3].ToDouble()), s, Библиотека_графики.Other.colors[st[6].ToInt32()], $"{st[7]} {st[8]} {st[9]}", FuncMethods.GaussBell2(s, sd * s)); });
public virtual bool ExecNode() { HandleTarget target = TargetMethods.GetTargetList(this, m_NodeData.TargetMethodId, null); if (target.GetTarget(EFuncTarget.EFT_Target).Count == 0) { if (m_CurrentTargetList.Count == 0) { // no target ,not trigger return(true); } else { foreach (Ilife elem in m_CurrentTargetList) { //离开 Debuger.Log("trigger exit " + elem.GetInstanceId()); HandleTarget tmpTarget = HandleTarget.GetHandleTarget(this, elem); if (LimitMethods.HandleLimitExec(tmpTarget, m_NodeData.ExitLimitMethodId, null)) { FuncMethods.HandleFuncExec(tmpTarget, m_NodeData.ExitFuncMethodId, null); } } m_CurrentTargetList.Clear(); } return(true); } List <Ilife> targetList = target.GetTarget(EFuncTarget.EFT_Target); for (int i = 0; i < targetList.Count; ++i) { if (m_NodeData.IsTick) { //进入 Debuger.Log("trigger enter " + targetList[i].GetInstanceId()); HandleTarget tmpTarget = HandleTarget.GetHandleTarget(this, targetList[i]); if (LimitMethods.HandleLimitExec(tmpTarget, m_NodeData.EnterLimitMethodId, null)) { FuncMethods.HandleFuncExec(tmpTarget, m_NodeData.EnterFuncMethodId, null); } } if (!m_CurrentTargetList.Contains(targetList[i])) { if (!m_NodeData.IsTick) { //进入 Debuger.Log("trigger enter " + targetList[i].GetInstanceId()); HandleTarget tmpTarget = HandleTarget.GetHandleTarget(this, targetList[i]); if (LimitMethods.HandleLimitExec(tmpTarget, m_NodeData.EnterLimitMethodId, null)) { FuncMethods.HandleFuncExec(tmpTarget, m_NodeData.EnterFuncMethodId, null); } } } else { m_CurrentTargetList.Remove(targetList[i]); } } foreach (Ilife elem in m_CurrentTargetList) { HandleTarget tmpTarget = HandleTarget.GetHandleTarget(this, elem); if (LimitMethods.HandleLimitExec(tmpTarget, m_NodeData.ExitLimitMethodId, null)) { //离开 Debuger.Log("trigger exit " + elem.GetInstanceId()); FuncMethods.HandleFuncExec(tmpTarget, m_NodeData.ExitFuncMethodId, null); } } ResetCurrentTargetList(targetList); //collection target instance return(true); }
protected override void Execute() { HandleTarget target = HandleTarget.GetHandleTarget(PlayerManager.Instance.GetPlayerInstance()); FuncMethods.HandleFuncExec(target, m_Config.FuncID, null); }