示例#1
0
        //产生单个数字
        public void GenerateNumber(string subNum)
        {
            UISprite uiGo = MonoGameObjectPool <UISprite> .Instance.GetUIGameObject();

            uiGo.atlas            = UIAtlasManager.GetInstance().GetUIAtlas(ResourceAtlasName);
            uiGo.spriteName       = fightType.ToString().Substring(2).ToLower() + "_" + subNum;
            uiGo.transform.parent = this.transform;
            //      uiGo.MakePixelPerfect();
            //调整位置
        }
示例#2
0
        private void storeInDB()
        {
            const string METHODNAME = "storeInDB";

            try
            {
                using (var session = NHibernateHelper.OpenSession())
                {
                    using (var transaction = session.BeginTransaction())
                    {
                        var fightEntry = session.QueryOver <FightHistory>().Where(x => x.FightId == FightId).SingleOrDefault();
                        if (fightEntry != null)
                        {
                            throw new SqlParseException("fight id already exists");
                        }

                        FightHistory newFightEntry = new FightHistory()
                        {
                            QueueCreatedTime    = QueueCreatedTime.UpToSeconds(),
                            FightStartedTime    = FightStartedTime.UpToSeconds(),
                            FightEndedTime      = FightEndedTime.UpToSeconds(),
                            FightId             = FightId,
                            FightType           = FightType.ToString(),
                            TeamSize            = TeamSize,
                            Location            = Location,
                            FightDuration       = FightDuration.ToString("g"),
                            MovesExchanged      = MovesExchanged,
                            TeamRedNames        = TeamRedNames,
                            TeamBlueNames       = TeamBlueNames,
                            LowestDamagePlayer  = LowestDamagePlayer,
                            HighestDamagePlayer = HighestDamagePlayer,
                            Winner = Winner
                        };


                        session.Save(newFightEntry);
                        transaction.Commit();
                    }
                }
            }
            catch (Exception e)
            {
                DebugUtils.Logp(DebugUtils.Level.WARNING, CLASSNAME, METHODNAME, "saving fight to history failed with: " + e.Message);
            }
        }