Example #1
0
    /// <summary>
    /// 服务器返回注册信息
    /// </summary>
    /// <param name="args"></param>
    private void OnRegCallback(CallbackArgs args)
    {
        if (args.hasError)
        {
            Debug.Log("模拟器报错:" + args.errorCode + args.errorMsg);
            UIDialogController.Instance.Show(args.errorCode + ":" + args.errorMsg);
        }
        else
        {
            Debug.Log("模拟器返回消息:" + args.json);
            AccountEntity entity = args.obj as AccountEntity;

            PlayerPrefs.SetInt(Constant.QuickLoginID, entity.Id);//记录快速登录信息
            PlayerPrefs.SetString(Constant.QuickLoginUsername, mRegView.Username.text);
            PlayerPrefs.SetString(Constant.QuickLoginPwd, mRegView.Pwd.text);
            StatUtil.Reg(entity.Id, mRegView.Username.text);//统计系统上报登录行为
            //放进缓存待用
            GlobalCache.Instance.Account_CurrentId           = entity.Id;
            GlobalCache.Instance.Account_LastLoginServerId   = entity.LastLoginServerId;
            GlobalCache.Instance.Account_LastLoginServerName = entity.LastLoginServerName;

            //mRegView.SelfCloseAndOpenNext(UIWindowType.EnterServer);
            mRegView.SelfClose();
            GameServerController.Instance.OpenView(UIPanelType.EnterServer);
        }
    }
Example #2
0
        public void TestUnbiasedStdDeviation()
        {
            double[] sample = { 43, 47, 52, 52, 54, 61, 67, 67, 68, 69, 70, 71, 71, 73, 76, 82, 84, 84, 91 };
            double   result = StatUtil.UnbiasedStdDeviation(sample);

            Assert.AreEqual(13.268, Math.Round(result, 3));
        }
Example #3
0
        public void Post(NewStat newStat)
        {
            Stat stat = new Stat
            {
                Nom        = newStat.Nom,
                Definition = newStat.Definition,
                Stats      = newStat.Stats,
                Type       = newStat.Type
            };

            foreach (NewStatUtil su in newStat.StatUtils)
            {
                StatUtil statUtil = new StatUtil {
                    Valeur = su.Valeur
                };
                Stat statUse = dal.GetStatById(su.StatUtile);
                statUtil.StatUtile = statUse;
                if (stat.StatUtils == null)
                {
                    stat.StatUtils = new List <StatUtil>();
                }
                stat.StatUtils.Add(statUtil);
            }
            dal.AddStat(stat);
        }
Example #4
0
        public void TestSamplingCor()
        {
            double[] datas1 = { 29, 29, 30, 32, 33, 32, 31, 26, 28, 31 };
            double[] datas2 = { 326, 364, 283, 369, 417, 436, 438, 296, 263, 389 };
            double   result = StatUtil.SamplingCor(datas1, datas2);

            Assert.AreEqual(0.7600, Math.Round(result, 4));
        }
Example #5
0
    private void OnLoginCallback(CallbackArgs args)
    {
        if (args.hasError)
        {
            ShowDialog(args.errorCode + ":" + args.errorMsg, UIDialogType.OK, okAction: () =>
            {
                //这是一个匿名委托,类似java匿名内部类、匿名方法一样
                Debug.Log("OK按钮回调,模拟器报错:" + args.errorCode + args.errorMsg);
            });
        }
        else
        {
            Debug.Log("login Callback模拟器返回消息:" + args.json);
            AccountEntity entity = args.obj as AccountEntity;
            if (entity.LastLoginServerName != "-1")
            {
                //记录最后登陆信息
                GlobalCache.Instance.Account_CurrentId           = entity.Id;
                GlobalCache.Instance.Account_LastLoginServerId   = entity.LastLoginServerId;
                GlobalCache.Instance.Account_LastLoginServerName = entity.LastLoginServerName;
            }
            else
            {
                //等于-1,表示这条数据没有LastLoginServerName,附上默认值
                GlobalCache.Instance.Account_CurrentId           = entity.Id;
                GlobalCache.Instance.Account_LastLoginServerId   = 1;
                GlobalCache.Instance.Account_LastLoginServerName = "双线1服";
            }
            if (mIsQuickLogin)
            {
                StatUtil.Login(entity.Id, PlayerPrefs.GetString(Constant.QuickLoginUsername)); //统计系统上报登录行为

                GameServerController.Instance.OpenView(UIPanelType.EnterServer);               //这种打开方式可以加载GameServerController上的委托
            }
            else
            {
                PlayerPrefs.SetInt(Constant.QuickLoginID, entity.Id);//记录快速登录信息
                PlayerPrefs.SetString(Constant.QuickLoginUsername, mLoginView.Username.text);
                PlayerPrefs.SetString(Constant.QuickLoginPwd, mLoginView.Pwd.text);
                StatUtil.Login(entity.Id, mLoginView.Username.text);//统计系统上报登录行为
                //mLoginView.SelfCloseAndOpenNext(UIWindowType.EnterServer);  //这种方式不能加载GameServerController上的委托
                mLoginView.SelfClose();
                GameServerController.Instance.OpenView(UIPanelType.EnterServer);
            }

            //SceneManager.Instance.LoadMainScene();
            //mLoginView.SelfClose();
        }
    }
Example #6
0
        public CommandApplicationProcess(RaftLog raftLog, int maxBatchSize, int flushEvery, System.Func <DatabaseHealth> dbHealth, LogProvider logProvider, ProgressTracker progressTracker, SessionTracker sessionTracker, CoreState coreState, InFlightCache inFlightCache, Monitors monitors)
        {
            if (!InstanceFieldsInitialized)
            {
                InitializeInstanceFields();
                InstanceFieldsInitialized = true;
            }
            this._raftLog         = raftLog;
            this._flushEvery      = flushEvery;
            this._progressTracker = progressTracker;
            this._sessionTracker  = sessionTracker;
            this._log             = logProvider.getLog(this.GetType());
            this._dbHealth        = dbHealth;
            this._coreState       = coreState;
            this._inFlightCache   = inFlightCache;
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            this._commitIndexMonitor = monitors.NewMonitor(typeof(RaftLogCommitIndexMonitor), this.GetType().FullName);
            this._batcher            = new CommandBatcher(maxBatchSize, this.applyBatch);
            this._batchStat          = StatUtil.create("BatchSize", _log, 4096, true);
        }
Example #7
0
 /// <summary>
 /// Adds to stat.
 /// </summary>
 /// <param name="statType">Type of the stat.</param>
 /// <param name="type">The type.</param>
 /// <param name="amount">The amount.</param>
 public void AddToStat(StatType statType, Set type, int amount)
 {
     if (HasStat(statType))
     {
         if (amount != 0)
         {
             Stat stat = baseStats[statType];
             if (type == Set.MOD)
             {
                 stat.Mod += amount;
             }
             else if (type == Set.MAX)
             {
                 stat.Max += amount;
             }
             else if (type == Set.MOD_UNBOUND)
             {
                 stat.SetMod(stat.Mod + amount, false);
             }
         }
         AddSplat(new SplatDetails(statType.DetermineColor(amount), StatUtil.ShowSigns(amount), statType.Sprite));
     }
 }
Example #8
0
 /// <summary>
 /// Compares agility values to determine who goes first.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns></returns>
 public int CompareTo(Stats other)
 {
     return(StatUtil.GetDifference(StatType.AGILITY, other, this));
 }
Example #9
0
 public void TestSamplingCorArgumentException()
 {
     double[] datas1 = {};
     double[] datas2 = {};
     StatUtil.SamplingCor(datas1, datas2);
 }
Example #10
0
 protected override bool IsCritical(Character caster, Character target)
 {
     return(Util.IsChance(BASE_CRITICAL_RATE + StatUtil.GetDifference(StatType.AGILITY, caster.Stats, target.Stats) * PERCENT));
 }
Example #11
0
 protected override bool IsHit(Character caster, Character target)
 {
     return(Util.IsChance(BASE_ACCURACY + StatUtil.GetDifference(StatType.AGILITY, caster.Stats, target.Stats) * PERCENT));
 }
Example #12
0
 public NewStatUtil(StatUtil su)
 {
     this.Id        = su.Id;
     this.StatUtile = su.StatUtile.Id;
     this.Valeur    = su.Valeur;
 }