Esempio n. 1
0
        public void ApiScorePostTestNormalWithNoRights()
        {
            string  userName = "******";
            UserApi api      = new UserApi(Common.DefaultConfig);

            api.ApiUserPost(Common.AdminAuth, new User(userName, userName, new List <UserRole>()));
            string    authorization = Common.GetAuthHeader(userName, userName);
            ScoreItem item          = new ScoreItem(null, Common.GameName, null, null, 100, Common.UserName);

            var ex = Assert.Catch(() => instance.ApiScorePost(authorization, item)) as ApiException;

            Assert.AreEqual(Common.ForbiddenCode, ex.ErrorCode);
        }
Esempio n. 2
0
        public GameView(TextureManager _t, SoundManagerEx _s, int level, Player p)
        {
            texturemanager     = _t;
            soundmanager       = _s;
            rendererlevel      = level;
            this.player        = p;
            GameEntityRenderer = Stage1State._renderer;          //获取控制器处的renderer
            // _Particles = new Particle.FlyingFlowersParticles(texturemanager);
            ScoreRenderer = new ScoreItem(_t);

            leftBottomBox = new LeftBottomBox(texturemanager);
            TitleStartBox = new GameViewComponent.TitleStartBox(texturemanager);
            BGMChangeBox  = new GameViewComponent.BGMChangeBox(texturemanager);
        }
Esempio n. 3
0
        public void ApiScorePostTestMassiveSequence()
        {
            int itemsToSend = 100;

            string    checkAuthorization = Common.AdminAuth;
            string    authorization      = Common.AdminAuth;
            ScoreItem item = new ScoreItem(null, Common.GameName, null, null, 100, Common.UserName);

            for (int i = 0; i < itemsToSend; i++)
            {
                var result = instance.ApiScorePost(authorization, item);
                Assert.IsNotNull(instance.ApiScoreHistoryGet(checkAuthorization).Select(obj => obj.Key == result.Key));
            }
        }
Esempio n. 4
0
    public static ScoreItemList CreateFromJSON(string jsonString)
    {
        ScoreItemList scoreItemList = new ScoreItemList();
        var           delimeter     = '|';

        string[] scoreStrings = jsonString.Split(delimeter);

        foreach (string scoreString in scoreStrings)
        {
            ScoreItem scoreItem = ScoreItem.CreateFromJSON(scoreString);
            scoreItemList.scores.Add(scoreItem);
        }
        return(scoreItemList);
    }
Esempio n. 5
0
        private static async Task Do()
        {
            IMongoDatabase          database   = _client.GetDatabase("school");
            IMongoCollection <Item> collection = database.GetCollection <Item>("students");

            List <Item> t = await collection.Find(new BsonDocument()).ToListAsync();

            foreach (Item item in t)
            {
                ScoreItem lowerst = item.Scores.OrderBy(x => x.Score).First(x => x.Type == "homework");
                item.Scores.Remove(lowerst);
                ReplaceOneResult result = await collection.ReplaceOneAsync(x => x.Id == item.Id, item);
            }
        }
Esempio n. 6
0
    private void GetClosestScoreItem()
    {
        _treasure = FindObjectsOfType <ScoreItem>();
        var distance = float.MaxValue;

        foreach (var t in _treasure)
        {
            var d = Vector3.Distance(transform.position, t.transform.position);
            if (d < distance)
            {
                distance    = d;
                _targetItem = t;
            }
        }
    }
    public void SetScore(params bool[] rightAnswers)
    {
        gameObject.SetActive(true);

        int index = 1;

        foreach (var answer in rightAnswers)
        {
            ScoreItem item = Instantiate(prefab.gameObject, holder).GetComponent <ScoreItem>();
            item.Activate(true);
            item.SetIndex(index);
            item.SetCorrect(answer);
            index++;
        }
    }
Esempio n. 8
0
 // GET: SelfRate
 public ActionResult Index()
 {
     try
     {
         if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
         {
             //Log.Error(ex + ex.StackTrace);
             TempData["SessionExipred"] = "true";
             //TempData["error"] = ex + ex.StackTrace;
             //tran.Rollback();
             return(RedirectToAction("Index", "Login", null));
         }
         MysqlDBA <ScoreItem> mysqlDBA = new MysqlDBA <ScoreItem>(FunctionController.CONNSTR);
         //MysqlDBA<InstScoreTable> mysqlDBAInstScoreTable = new MysqlDBA<InstScoreTable>(FunctionController.CONNSTR);
         List <ScoreItem>      lstScoreItem      = new List <ScoreItem>();
         DataSet               scoreItemsdateSet = mysqlDBA.getDataSet(string.Format("SELECT * FROM ScoreItem WHERE ItemParentNo='-1'"));
         List <InstScoreTable> instScoreTables   = Utility.Utility.getInstScore(Session["INSTNO"].ToString(), (DateTime.Now.Year - 1911).ToString());
         foreach (DataRow scoreItem in scoreItemsdateSet.Tables[0].Rows)
         {
             ScoreItem score_Item = new ScoreItem();
             score_Item.ItemNo       = scoreItem["ItemNo"].ToString();
             score_Item.ItemParentNo = scoreItem["ItemParentNo"].ToString();
             score_Item.ItemDesc     = scoreItem["ItemDesc"].ToString();
             score_Item.ItemGrade    = scoreItem["ItemGrade"].ToString();
             score_Item.ItemScore    = scoreItem["ItemScore"].ToString();
             score_Item.EvalYear     = scoreItem["EvalYear"].ToString();
             score_Item.EvalType     = scoreItem["EvalType"].ToString();
             score_Item.CreateDate   = scoreItem["CreateDate"].ToString();
             score_Item.getChildItem(Session["INSTNO"].ToString(), score_Item.ItemNo);
             lstScoreItem.Add(score_Item);
             if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
             {
                 TempData["SessionExipred"] = "true";
                 return(RedirectToAction("Index", "Login", null));
             }
         }
         TempData["ScoreItems"] = lstScoreItem;
         TempData["InstScores"] = instScoreTables;
     }
     catch (Exception ex)
     {
         Log.Error(ex + ex.StackTrace);
         TempData["action"] = "Function";
         TempData["error"]  = ex + ex.StackTrace;
         return(RedirectToAction("Index", "SelfRate", null));
     }
     return(View());
 }
Esempio n. 9
0
    void Explode()
    {
        int     bricksLayerMask = LayerMask.GetMask("Bricks");
        Vector3 p0 = transform.position + Vector3.up * bombVerticalRange;
        Vector3 p1 = transform.position + Vector3.down * bombVerticalRange;

        Collider[] colliders = Physics.OverlapCapsule(p0, p1, explosionRadius, bricksLayerMask);

        Obstacle obstacle = colliders.Length > 0 ? colliders[0].GetComponentInParent <Obstacle>() : null;

        if (obstacle != null)
        {
            foreach (Collider collider in colliders)
            {
                bool isGold = collider.CompareTag("Gold");
                if (isGold && !InputManager.Instance.isSuperBombActive)
                {
                    continue;
                }


                GameObject shatteredPrefab = isGold ? shatteredGoldBrickPrefab : shatteredBrickPrefab;
                GameObject scatteredBrick  = Instantiate(shatteredPrefab, collider.transform.position, collider.transform.rotation);
                obstacle.AddToScatters(scatteredBrick);

                Destroy(collider.gameObject);

                foreach (Rigidbody rb in scatteredBrick.GetComponentsInChildren <Rigidbody>())
                {
                    rb.AddExplosionForce(explosionForce, transform.position, explosionRadius);
                }
            }

            ScoreItem scoreItem = new ScoreItem(colliders.Length, scorePerBrick * colliders.Length);
            ScoreManager.Instance.AddScore(ScoreType.Brick, scoreItem);
        }

        if (explosionVFX)
        {
            ParticleSystem explosionVFXInstance = Instantiate(explosionVFX, transform.position, Quaternion.identity, MemoryManager.Instance.transform);
            explosionVFXInstance.gameObject.transform.LookAt(GameManager.mainCamera.transform);
        }

        GameManager.mainCamera.Shake(screenShakeMagnitude);
        AudioManager.Instance.Play(explosionSFX);
        trail.transform.SetParent(MemoryManager.Instance.transform);
        Destroy(gameObject);
    }
Esempio n. 10
0
 public void Update(ScoreItem item)
 {
     lock ( _context )
     {
         ScoreItem score = _context.Scores.Find(item.Key);
         if (score != null)
         {
             score.Date    = item.Date;
             score.Game    = item.Game;
             score.Param   = item.Param;
             score.Score   = item.Score;
             score.User    = item.User;
             score.Version = item.Version;
             _context.SaveChanges();
         }
     }
 }
Esempio n. 11
0
 private void CreateScoreBoardClient()
 {
     if (scoreJsonMsg != null)
     {
         SaveScoreJsonMsg(scoreJsonMsg);
     }
     for (int i = 0; i < scoreMsg.scoreList.Count && i < maxScoreNum; i++)
     {
         ScoreItem  item           = scoreMsg.scoreList[i];
         GameObject scoreRow       = Instantiate(scoreRowPefab) as GameObject;
         ScoreRow   scoreRowScript = scoreRow.GetComponent <ScoreRow>();
         scoreRowScript.rankNum.text  = item.account.ToString();
         scoreRowScript.score.text    = item.score.ToString();
         scoreRowScript.dateTime.text = item.time.ToString();
         scoreRow.transform.SetParent(contentPanel, false);
         //Debug.Log(scoreRow.transform.localPosition.ToString());
     }
 }
Esempio n. 12
0
 // прочитать счет обоих режимов из файла
 public ClassScoreManager ReadScores()
 {
     try
     {
         var        sdCardPath        = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
         var        filePath          = System.IO.Path.Combine(sdCardPath + "/Application/Dageron Studio", "dageron_angry_pacman.xml");
         FileStream fStream           = new FileStream(filePath, FileMode.Open, FileAccess.Read);
         var        myBinaryFormatter = new BinaryFormatter();
         var        mc = (ClassScoreManager)myBinaryFormatter.Deserialize(fStream);
         fStream.Close();
         return(mc);
     }
     catch (Exception e)
     {
         Score = new ScoreItem();
         return(this);
     }
 }
Esempio n. 13
0
    public int CompareTo(object obj)
    {
        if (obj == null)
        {
            return(1);
        }

        ScoreItem otherItem = obj as ScoreItem;

        if (otherItem != null)
        {
            return(this.score.CompareTo(otherItem.score));
        }
        else
        {
            throw new ArgumentException("Object is not a ScoreItem");
        }
    }
Esempio n. 14
0
 public IActionResult Create([FromBasicAuth] string auth, [FromBody] ScoreItem item)
 {
     if (item == null)
     {
         return(BadRequest());
     }
     if (!Auth.IsAllowed(auth, item.Game, UserPermission.PostScores))
     {
         return(Auth.Result);
     }
     if (GameItems.Find(item.Game) == null)
     {
         return(BadRequest("Game not found"));
     }
     item.Date = DateTime.Now;
     ScoreItems.Add(item);
     return(CreatedAtRoute("GetScore", new { id = item.Key }, item));
 }
Esempio n. 15
0
        public void AddScore(IMove move, int score)
        {
            ScoreItem new_item = new ScoreItem(move, score, _sortBySpace);

            lock (_sync)
            {
                //if(_scores.Count < _scores.Capacity)
                //{
                _scores.Add(new_item);
                _scores.Sort();
                //}
                //else if (new_item.CompareTo(_scores.Last()) > 0)
                //{
                //    _scores[_scores.Count - 1] = new_item;
                //    _scores.Sort();
                //}
            }
        }
Esempio n. 16
0
    public void AddScore(ScoreType type, ScoreItem item)
    {
        scoresByType[type] += item;

        float newScore = Score;

        scoreSlider.value = newScore;

        int currentLevel = LevelManager.level;

        if (newScore >= currentLevelMaxScore)
        {
            scoreSlider.minValue = currentLevelMaxScore;
            currentLevelMaxScore = GetLevelMaxScore(currentLevel + 1);
            scoreSlider.maxValue = currentLevelMaxScore;
            LevelManager.Instance.LevelUp();
        }
    }
Esempio n. 17
0
 // прочитать счет обоих режимов из файла
 public ClassScoreManager ReadScores()
 {
     try
     {
         var sdCardPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
         var filePath = System.IO.Path.Combine(sdCardPath+"/Application/Dageron Studio", "dageron_angry_pacman.xml");
         FileStream fStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
         var myBinaryFormatter = new BinaryFormatter();
         var mc = (ClassScoreManager) myBinaryFormatter.Deserialize(fStream);
         fStream.Close();
         return mc;
     }
     catch (Exception e)
     {
         Score = new ScoreItem ();
         return this;
     }
 }
Esempio n. 18
0
        /**
         * Get Scores saved on PlayerPrefs
         **/
        public List <ScoreItem> GetSavedTopScores()
        {
            var lst = new List <ScoreItem>();

            var i = 0;

            while (i < MaxScoresSaved && PlayerPrefs.HasKey("Scores[" + i + "].name"))
            {
                var strAux   = PlayerPrefs.GetString("Scores[" + i + "].playerType");
                var pTypeAux = strAux == PlayerType.Boss.ToString() ? PlayerType.Boss : PlayerType.Employee;
                var tmp      = new ScoreItem(
                    PlayerPrefs.GetInt("Scores[" + i + "].score"),
                    PlayerPrefs.GetString("Scores[" + i + "].name"),
                    pTypeAux);
                lst.Add(tmp);
                i++;
            }

            return(lst);
        }
Esempio n. 19
0
        public static string getScoreTitle(string itemNo)
        {
            string strRet = string.Empty;

            try
            {
                MysqlDBA <ScoreItem> mysqlDBA_AttrBase = new MysqlDBA <ScoreItem>(FunctionController.CONNSTR);
                ScoreItem            baseattr          = new ScoreItem();
                baseattr.ItemNo = itemNo;
                List <ScoreItem> objLst = (List <ScoreItem>)mysqlDBA_AttrBase.getDataList(baseattr);
                if (objLst.Count > 0)
                {
                    strRet = objLst[0].ItemDesc;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(strRet);
        }
Esempio n. 20
0
 public void Init()
 {
     if (ScoreSheet == null)
     {
         return;
     }
     GridItems.ColumnDefinitions.Clear();
     GridItems.Children.Clear();
     for (int i = 0; i < ScoreSheet.Items.Count; i++)
     {
         ScoreItem item = ScoreSheet.Items[i];
         if (item.Type == ScoreObjectType.ScoreGroup)
         {
             UCScoreGroupViewer ucScoreGroup = new UCScoreGroupViewer();
             ucScoreGroup.ScoreGroup = item as ScoreGroup;
             if (i > 0)
             {
                 ucScoreGroup.BorderThickness = new Thickness(1, 0, 0, 0);
             }
             GridItems.ColumnDefinitions.Add(new ColumnDefinition());
             GridItems.Children.Add(ucScoreGroup);
             ucScoreGroup.SetValue(Grid.ColumnProperty, i);
             ucScoreGroup.Init();
         }
         else
         {
             UCStandardViewer ucStandard = new UCStandardViewer();
             ucStandard.Standard = item as Standard;
             if (i > 0)
             {
                 ucStandard.BorderThickness = new Thickness(1, 0, 0, 0);
             }
             GridItems.ColumnDefinitions.Add(new ColumnDefinition());
             GridItems.Children.Add(ucStandard);
             ucStandard.SetValue(Grid.ColumnProperty, i);
             ucStandard.Init();
         }
     }
     ScoreObject_OnPropertyChanged(this, null);
 }
Esempio n. 21
0
        private void InitScoreGroupList()
        {
            mListScoreGroups.Clear();
            if (ScoreSheet == null)
            {
                return;
            }
            ScoreSheet.SetItemLevel();
            List <ScoreItem> listItems = new List <ScoreItem>();

            ScoreSheet.GetAllScoreItem(ref listItems);
            for (int i = 0; i < listItems.Count; i++)
            {
                ScoreItem  item  = listItems[i];
                ScoreGroup group = item as ScoreGroup;
                if (group != null)
                {
                    mListScoreGroups.Add(group);
                }
            }
            mListScoreGroups.Add(ScoreSheet);
        }
Esempio n. 22
0
        private void win()
        {
            minClok1.Pause();
            clok1.Pause();
            Console.WriteLine(minClok1.Minutes.ToString() + ":" + clok1.Seconds.ToString());
            ListViewItem lvi = new ListViewItem();

            lvi.Text = player; //(This is the 'name' property of our form)
            lvi.SubItems.Add(minClok1.Minutes.ToString() + ":" + clok1.Seconds.ToString());

            lvi.SubItems.Add(rollCount.Text);
            lvScores.Items.Add(lvi);
            ScoreItem s = new ScoreItem();

            s.Name  = player;
            s.Time  = minClok1.Minutes.ToString() + ":" + clok1.Seconds.ToString();
            s.Moves = Convert.ToInt32(rollCount.Text);
            ExistingScoresList.Add(s);
            save();

            output.Text = "You Win!!!";
        }
Esempio n. 23
0
    /// <summary>
    /// initialize score list
    /// </summary>
    void InitScore()
    {
        HashSet <float> scores = new HashSet <float>();

        if (PlayerPrefs.HasKey("ScoreData"))
        {
            // gettings scores from prefs
            scores = new HashSet <float>(JsonUtility.FromJson <ScoreData>(PlayerPrefs.GetString("ScoreData", "")).scores.OrderByDescending(x => x));
        }

        int count = 0;


        //spawn score items
        foreach (float score in scores)
        {
            count++;
            ScoreItem item = Instantiate(scorePref, scorePref.transform.parent);
            item.score.text = score.ToString();
            item.gameObject.SetActive(true);
            item.image.color = scoreGradient.Evaluate(((float)scores.Count / (float)count) / (float)scores.Count); // setup color for score item
        }
    }
Esempio n. 24
0
        void ScoreObject_OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ScoreItem scoreItem = ScoreGroup;

            if (scoreItem != null)
            {
                VisualStyle style = scoreItem.TitleStyle;
                if (style != null)
                {
                    LbTitle.Foreground     = new SolidColorBrush(style.ForeColor);
                    BorderTitle.Background = new SolidColorBrush(style.BackColor);
                    if (style.FontFamily != null)
                    {
                        LbTitle.FontFamily = style.FontFamily;
                    }
                    if (style.FontSize != 0)
                    {
                        LbTitle.FontSize = style.FontSize;
                    }
                    LbTitle.FontWeight = style.FontWeight;
                }
                style = scoreItem.PanelStyle;
                if (style != null)
                {
                    if (style.Width != 0)
                    {
                        BorderPanel.Width = style.Width;
                    }
                    else
                    {
                        BorderPanel.ClearValue(WidthProperty);
                    }
                    BorderPanel.Background = new SolidColorBrush(style.BackColor);
                }
            }
        }
Esempio n. 25
0
        private void CreateFlagIcons()
        {
            if (ScoreItem == null)
            {
                return;
            }
            if (mPanelFlags == null)
            {
                return;
            }
            mPanelFlags.Children.Clear();
            IconButton    iconItem;
            ScoreSetting  setting;
            ScoreLangauge langauge;

            //描述
            if (!string.IsNullOrEmpty(ScoreItem.Description))
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnDescription";
                iconItem.Display = "Description";
                iconItem.ToolTip = "Show or Close Description";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T102");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/info.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_DESCRIPTION");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //备注
            if (ScoreItem.Comments.Count > 0 &&
                !(ScoreItem is ScoreSheet))
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnComments";
                iconItem.Display = "Comments";
                iconItem.ToolTip = "Show or Close Comments";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T103");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/showcomment.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_COMMENT_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //关键项
            if (ScoreItem.IsKeyItem)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnKeyItem";
                iconItem.Display = "KeyItem";
                iconItem.ToolTip = "Key Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T104");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/keyitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_KEY_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //附加项
            if (ScoreItem.IsAddtionItem)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnAdditionItem";
                iconItem.Display = "AdditionItem";
                iconItem.ToolTip = "Addition Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T105");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/additionalitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_ADD_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //自动评分项
            var standard = ScoreItem as Standard;

            if (standard != null && standard.IsAutoStandard)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnAutoStandardItem";
                iconItem.Display = "AutoStandardItem";
                iconItem.ToolTip = "AutoStandard Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T109");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/autostandard.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_AUTO_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            var controlFlag = ScoreItem.ControlFlag;

            //控制源
            if ((controlFlag & 1) != 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnControlSource";
                iconItem.Display = "ControlSource";
                iconItem.ToolTip = "Control Source Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T106");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                List <ControlItem> listControlItems = new List <ControlItem>();
                ScoreItem.GetControlScoreItem(ref listControlItems);
                if (listControlItems.Count > 0)
                {
                    string strToolTip = string.Empty;
                    for (int i = 0; i < listControlItems.Count; i++)
                    {
                        var item = listControlItems[i];
                        strToolTip += string.Format("\r\n({0}) {1}", i, item.GetControlInfo());
                    }
                    iconItem.ToolTip += strToolTip;
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/controlitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_CTL_SRC");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //控制目标
            if ((controlFlag & 2) != 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnControlTarget";
                iconItem.Display = "ControlTarget";
                iconItem.ToolTip = "Control Target Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T107");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                List <ControlItem> listControledItems = new List <ControlItem>();
                ScoreItem.GetControledScoreItem(ref listControledItems);
                if (listControledItems.Count > 0)
                {
                    string strToolTip = string.Empty;
                    for (int i = 0; i < listControledItems.Count; i++)
                    {
                        var item = listControledItems[i];
                        strToolTip += string.Format("\r\n({0}) {1}", i, item.GetControlInfo());
                    }
                    iconItem.ToolTip += strToolTip;
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/controltarget.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_CTL_TGT");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
        }
Esempio n. 26
0
 public IHttpActionResult GetResults(int id, int? groupId = null)
 {
     Fixture found = Database.GetFixture(id);
     Dictionary<Team, int> result = new Dictionary<Team, int>();
     if (found == null)
     {
         return NotFound();
     }
     else
     {
         switch (found.Mode)
         {
             case MatchMode.Tournament:
                 //TODO:Retrive teams according positions, once it is ended
                 if (groupId.HasValue)
                 {
                     var group = found.Groups.SingleOrDefault(g => g.Id == groupId.Value);
                     result = group == null ? null : group.Scores;
                 }
                 break;
             case MatchMode.LeagueOneWay:
             case MatchMode.LeagueTwoWay:
                 result = found.TeamScores;
                 break;
         }
         List<ScoreItem> scores =new List<ScoreItem>();
         foreach (var keyValue in result)
         {
             var score = new ScoreItem() {TeamName = keyValue.Key.Name, Score = keyValue.Value};
             scores.Add(score);
         }
         scores.Sort(new ScoreComparer());
         return Ok(scores);
     }
 }
Esempio n. 27
0
        public static ScoreItem LoggedInPlayerScore(string UserCode, string LevelName)
        {
            ScoreItem playerScore = new ScoreItem();
            var       connection  = new SqlConnection(ConfigurationManager.ConnectionStrings["jhealthConnection"].ConnectionString);

            using (var db = new HpbDbContext(connection))
            {
                //var cmd = db.Database.Connection.CreateCommand();

                //cmd.CommandText = "SP_GetPlayerScore_HPB";

                //cmd.CommandType = System.Data.CommandType.StoredProcedure;

                //DbParameter param1 = cmd.CreateParameter();
                //param1.DbType = DbType.String;
                //param1.ParameterName = "@UserCode";
                //param1.Value = UserCode;
                //cmd.Parameters.Add(param1);

                //try
                //{
                //    if (db.Database.Connection.State != ConnectionState.Open)
                //        db.Database.Connection.Open();

                //    var reader = cmd.ExecuteReader();

                //    var rsBadges = ((IObjectContextAdapter)db).ObjectContext.Translate<ScoreItem>(reader);

                //    playerScore = rsBadges.First();

                //}
                //catch (Exception exp)
                //{
                //    throw exp;
                //}
                //finally
                //{
                //    db.Database.Connection.Close();
                //}

                var cmd = db.Database.Connection.CreateCommand();

                cmd.CommandText = "SP_LeaderBoardHS_HPB";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                DbParameter param1 = cmd.CreateParameter();
                param1.DbType        = DbType.String;
                param1.ParameterName = "@UserId";
                param1.Value         = UserCode;
                cmd.Parameters.Add(param1);

                DbParameter param2 = cmd.CreateParameter();
                param2.DbType        = DbType.String;
                param2.ParameterName = "@LevelName";
                param2.Value         = LevelName;
                cmd.Parameters.Add(param2);

                DbParameter param3 = cmd.CreateParameter();
                param3.DbType        = DbType.Int32;
                param3.ParameterName = "@PageStart";
                param3.Value         = 0;
                cmd.Parameters.Add(param3);

                DbParameter param4 = cmd.CreateParameter();
                param4.DbType        = DbType.Int32;
                param4.ParameterName = "@PageLength";
                param4.Value         = 10;
                cmd.Parameters.Add(param4);

                try
                {
                    if (db.Database.Connection.State != ConnectionState.Open)
                    {
                        db.Database.Connection.Open();
                    }

                    var reader = cmd.ExecuteReader();

                    //var rsCount = ((IObjectContextAdapter)db).ObjectContext.Translate<int>(reader);

                    //playerScore.Count = rsCount.FirstOrDefault<int>();

                    reader.NextResult();

                    //var rsScores = ((IObjectContextAdapter)db).ObjectContext.Translate<ScoreItem>(reader);

                    //playerScore.LeaderboardScores = rsScores.ToArray<ScoreItem>().ToList();

                    reader.NextResult();

                    var rsPlayerScore = ((IObjectContextAdapter)db).ObjectContext.Translate <ScoreItem>(reader);

                    playerScore = rsPlayerScore.FirstOrDefault <ScoreItem>();
                }
                catch (Exception exp)
                {
                    throw exp;
                }
                finally
                {
                    db.Database.Connection.Close();
                }
            }

            return(playerScore);
        }
Esempio n. 28
0
        private OperationReturn LoadScoreItem(SessionInfo session, ScoreItem parent, string scoreID)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string     rentToken  = session.RentInfo.Token;
                ScoreSheet scoreSheet = parent.ScoreSheet;
                if (scoreSheet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("ScoreSheet is null");
                    return(optReturn);
                }
                string temp1 = string.Empty;
                string temp2 = string.Empty;
                if (!string.IsNullOrWhiteSpace(scoreID))
                {
                    temp1 = string.Format(",T3109.C005 AS NA");
                    temp2 = string.Format(" LEFT JOIN T_31_009_{0} T3109 ON T3102.C002=T3109.C002", rentToken);
                }
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    strSql = string.Format(
                        "SELECT T3102.*{4} FROM T_31_002_{0} T3102{5}  WHERE T3102.C003 = {1} AND T3102.C004 = {2}{3} ",
                        rentToken, scoreSheet.ID, parent.ID, scoreID, temp1, temp2);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql = string.Format(
                        "SELECT T3102.*{4} FROM T_31_002_{0} T3102{5} WHERE T3102.C003 = {1} AND T3102.C004 = {2}{3} ",
                        rentToken, scoreSheet.ID, parent.ID, scoreID, temp1, temp2);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("DBType invalid");
                    return(optReturn);
                }
                if (objDataSet == null || objDataSet.Tables.Count <= 0)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null or DataTables empty");
                    return(optReturn);
                }
                List <ScoreItem> listItems = new List <ScoreItem>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow   dr = objDataSet.Tables[0].Rows[i];
                    ScoreItem scoreItem;
                    bool      isStandard = dr["C009"].ToString() == "Y";
                    if (isStandard)
                    {
                        Standard     standard     = null;
                        StandardType standardType = (StandardType)Convert.ToInt32(dr["C015"]);
                        switch (standardType)
                        {
                        case StandardType.Numeric:
                            NumericStandard numericStandard = new NumericStandard();
                            numericStandard.Type         = ScoreObjectType.NumericStandard;
                            numericStandard.MaxValue     = Convert.ToDouble(dr["C027"]);
                            numericStandard.MinValue     = Convert.ToDouble(dr["C028"]);
                            numericStandard.DefaultValue = string.IsNullOrWhiteSpace(dr["C029"].ToString()) ? 0 : Convert.ToDouble(dr["C029"]);
                            numericStandard.ScoreClassic = StandardClassic.TextBox;
                            standard = numericStandard;
                            break;

                        case StandardType.YesNo:
                            YesNoStandard yesNoStandard = new YesNoStandard();
                            yesNoStandard.Type = ScoreObjectType.YesNoStandard;
                            if (string.IsNullOrWhiteSpace(dr["C029"].ToString()))
                            {
                                yesNoStandard.DefaultValue = false;
                            }
                            else
                            {
                                if (Convert.ToDouble(dr["C029"]) == 1.0)
                                {
                                    yesNoStandard.DefaultValue = true;
                                }
                                else
                                {
                                    yesNoStandard.DefaultValue = false;
                                }
                            }
                            yesNoStandard.ReverseDisplay = dr["C104"].ToString() == "1";
                            yesNoStandard.ScoreClassic   = StandardClassic.YesNo;
                            standard = yesNoStandard;
                            break;

                        case StandardType.Slider:
                            SliderStandard sliderStandard = new SliderStandard();
                            sliderStandard.Type         = ScoreObjectType.SliderStandard;
                            sliderStandard.MinValue     = Convert.ToDouble(dr["C023"]);
                            sliderStandard.MaxValue     = Convert.ToDouble(dr["C024"]);
                            sliderStandard.Interval     = Convert.ToDouble(dr["C026"]);
                            sliderStandard.DefaultValue = string.IsNullOrWhiteSpace(dr["C029"].ToString()) ? 0 : Convert.ToDouble(dr["C029"]);
                            sliderStandard.ScoreClassic = StandardClassic.Slider;
                            standard = sliderStandard;
                            break;

                        case StandardType.Item:
                            ItemStandard itemStandard = new ItemStandard();
                            itemStandard.Type         = ScoreObjectType.ItemStandard;
                            itemStandard.ScoreClassic = StandardClassic.DropDownList;
                            itemStandard.DefaultIndex = string.IsNullOrWhiteSpace(dr["C029"].ToString())?0: Convert.ToInt32(dr["C029"]);
                            standard = itemStandard;
                            break;
                        }
                        if (standard == null)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = Defines.RET_OBJECT_NULL;
                            optReturn.Message = string.Format("Standard is null");
                            return(optReturn);
                        }
                        standard.PointSystem    = Convert.ToDouble(dr["C018"]);
                        standard.StandardType   = standardType;
                        standard.IsAutoStandard = dr["C101"].ToString() == "Y";
                        if (!string.IsNullOrWhiteSpace(scoreID))
                        {
                            if (string.IsNullOrWhiteSpace(dr["NA"].ToString()))
                            {
                                standard.IsNA = false;
                            }
                            else
                            {
                                standard.IsNA = dr["NA"].ToString() == "Y" ? true : false;
                            }
                        }
                        string strStaID = dr["C102"].ToString();
                        long   staID;
                        if (long.TryParse(strStaID, out staID))
                        {
                            standard.StatisticalID = staID;
                        }
                        scoreItem = standard;
                    }
                    else
                    {
                        ScoreGroup scoreGroup = new ScoreGroup();
                        scoreGroup.Type  = ScoreObjectType.ScoreGroup;
                        scoreGroup.IsAvg = dr["C016"].ToString() == "Y";
                        scoreItem        = scoreGroup;
                    }
                    scoreItem.ScoreSheet     = parent.ScoreSheet;
                    scoreItem.Parent         = parent;
                    scoreItem.ItemID         = Convert.ToInt32(dr["C001"]);
                    scoreItem.ID             = Convert.ToInt64(dr["C002"]);
                    scoreItem.OrderID        = Convert.ToInt32(dr["C005"]);
                    scoreItem.Title          = dr["C006"].ToString();
                    scoreItem.Description    = dr["C007"].ToString();
                    scoreItem.TotalScore     = Convert.ToDouble(dr["C008"]);
                    scoreItem.IsAbortScore   = dr["C010"].ToString() == "Y";
                    scoreItem.ControlFlag    = dr["C011"].ToString() == "Y" ? 1 : 0;
                    scoreItem.IsKeyItem      = dr["C012"].ToString() == "Y";
                    scoreItem.IsAllowNA      = dr["C013"].ToString() == "Y";
                    scoreItem.IsJumpItem     = dr["C014"].ToString() == "Y";
                    scoreItem.IsAddtionItem  = dr["C017"].ToString() == "Y";
                    scoreItem.UsePointSystem = dr["C019"].ToString() == "Y";
                    scoreItem.ScoreType      = dr["C020"].ToString() == "F"
                        ? ScoreType.YesNo
                        : dr["C020"].ToString() == "P" ? ScoreType.Pecentage : ScoreType.Numeric;
                    scoreItem.Tip = dr["C022"].ToString();
                    scoreItem.AllowModifyScore = dr["C103"].ToString() == "Y";

                    #region 子项

                    //如果是 ScoreGroup 加载子项
                    if (!isStandard)
                    {
                        ScoreGroup scoreGroup = scoreItem as ScoreGroup;
                        optReturn = LoadScoreItem(session, scoreGroup, scoreID);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        List <ScoreItem> subItems = optReturn.Data as List <ScoreItem>;
                        if (subItems == null)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = Defines.RET_OBJECT_NULL;
                            optReturn.Message = string.Format("ListItems is null");
                            return(optReturn);
                        }
                        for (int j = 0; j < subItems.Count; j++)
                        {
                            ScoreItem subItem = subItems[j];
                            scoreGroup.Items.Add(subItem);
                        }
                        scoreGroup.Items = scoreGroup.Items.OrderBy(j => j.OrderID).ToList();
                    }

                    //如果是多值型评分标准,加载评分标准子项
                    ItemStandard temp = scoreItem as ItemStandard;
                    if (temp != null)
                    {
                        optReturn = LoadStandardItem(session, temp);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        List <StandardItem> valueItems = optReturn.Data as List <StandardItem>;
                        if (valueItems == null)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = Defines.RET_OBJECT_NULL;
                            optReturn.Message = string.Format("ValueItems is null");
                            return(optReturn);
                        }
                        for (int j = 0; j < valueItems.Count; j++)
                        {
                            StandardItem valueItem = valueItems[j];
                            temp.ValueItems.Add(valueItem);
                        }
                        temp.ValueItems = temp.ValueItems.OrderBy(j => j.OrderID).ToList();
                    }

                    #endregion


                    #region 备注

                    OperationReturn commentReturn;
                    commentReturn = LoadComment(session, scoreItem);
                    if (!commentReturn.Result)
                    {
                        return(commentReturn);
                    }
                    List <Comment> listComments = commentReturn.Data as List <Comment>;
                    if (listComments == null)
                    {
                        optReturn.Result  = false;
                        optReturn.Code    = Defines.RET_OBJECT_NULL;
                        optReturn.Message = string.Format("listComments is null");
                        return(optReturn);
                    }
                    for (int j = 0; j < listComments.Count; j++)
                    {
                        Comment comment = listComments[j];
                        scoreItem.Comments.Add(comment);
                    }
                    scoreItem.Comments = scoreItem.Comments.OrderBy(j => j.OrderID).ToList();

                    #endregion

                    #region 样式

                    OperationReturn styleReturn;
                    styleReturn = LoadVisualStyle(session, scoreItem, "T");
                    if (!styleReturn.Result)
                    {
                        if (styleReturn.Code != Defines.RET_NOT_EXIST)
                        {
                            return(styleReturn);
                        }
                        scoreItem.TitleStyle = null;
                    }
                    else
                    {
                        VisualStyle style = styleReturn.Data as VisualStyle;
                        if (style != null)
                        {
                            style.ScoreSheet     = scoreSheet;
                            scoreItem.TitleStyle = style;
                        }
                    }

                    styleReturn = LoadVisualStyle(session, scoreItem, "P");
                    if (!styleReturn.Result)
                    {
                        if (styleReturn.Code != Defines.RET_NOT_EXIST)
                        {
                            return(styleReturn);
                        }
                        scoreItem.PanelStyle = null;
                    }
                    else
                    {
                        VisualStyle style = styleReturn.Data as VisualStyle;
                        if (style != null)
                        {
                            style.ScoreSheet     = scoreSheet;
                            scoreItem.PanelStyle = style;
                        }
                    }

                    #endregion

                    listItems.Add(scoreItem);
                }
                optReturn.Data = listItems;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Esempio n. 29
0
        public static void Initialize(QuizContext context)
        {
            context.Database.EnsureCreated();

            if (context.QuizItems.Any())
            {
                return;
            }

            var quizItems = new QuizItem[]
            {
                new QuizItem {
                    Title   = "Is Lorem Ipsum the industry's standard dummy text?",
                    Answer  = "Yes",
                    Option1 = "No",
                    Option2 = "Lorem ipsum dolor sit amet"
                },

                new QuizItem {
                    Title   = "Why?",
                    Answer  = "I don't know man, I just came for the pizza",
                    Option1 = "Yeet",
                    Option2 = "This is the right answer"
                },

                new QuizItem {
                    Title   = "Have you tried Vegemite?",
                    Answer  = "Oi mate, I got that vegemite stuck in me peen",
                    Option1 = "Vegemite is just up-side-down Marmite",
                    Option2 = "I svea rike använder vi enbart Tartex och smörgåsgurka"
                },

                new QuizItem {
                    Title   = "PK fire?",
                    Answer  = "PK FIRE! PK FIRE! PK FIRE! PK FIRE!",
                    Option1 = "Backthrow needs a buff",
                    Option2 = "PK Thunder is a great recovery"
                },

                new QuizItem {
                    Title   = "How much wood would a woodchuck chuck if a woodchuck could feel happyness?",
                    Answer  = "80 painful years",
                    Option1 = "null",
                    Option2 = "NaN"
                },

                new QuizItem {
                    Title   = "Does thou skrrt skrrt?",
                    Answer  = "Yes but on the inside I hurt hurt",
                    Option1 = "Big Shaq boom boom",
                    Option2 = "lmao ye man"
                },

                new QuizItem {
                    Title   = "What's your story",
                    Answer  = "...",
                    Option1 = "I was finally awake! I tried to cross the border and walked right into that imperial ambush same as that thief over there.",
                    Option2 = "At age six I was born without a face."
                },

                new QuizItem {
                    Title   = "Hello there!",
                    Answer  = "General Kenobi!",
                    Option1 = "I came to chew ass and kick bubblegum",
                    Option2 = "Oj! Vilken överaskning! Kommer och filmar mig när jag går på muggen!"
                },

                new QuizItem {
                    Title   = "What in Oblivion is that!?",
                    Answer  = "a footlong Dragon D***o",
                    Option1 = "Crocs",
                    Option2 = "My will to live"
                },

                new QuizItem {
                    Title   = "What have we got to lose?",
                    Answer  = "Nothing but our chains",
                    Option1 = "Deez nutz",
                    Option2 = "seething hatred for the muffinman"
                }
            };

            context.AddRange(quizItems);
            context.SaveChanges();

            if (context.ScoreItems.Any())
            {
                return;
            }

            var scoreItems = new ScoreItem[]
            {
                new ScoreItem()
                {
                    User  = "******",
                    Score = 8
                },

                new ScoreItem()
                {
                    User  = "******",
                    Score = 2
                },

                new ScoreItem()
                {
                    User  = "******",
                    Score = 0
                },

                new ScoreItem()
                {
                    User  = "******",
                    Score = 5
                },

                new ScoreItem()
                {
                    User  = "******",
                    Score = 12
                },
            };

            context.ScoreItems.AddRange(scoreItems);
            context.SaveChanges();
        }
Esempio n. 30
0
 public void Start()
 {
     itemGen   = this.gameObject.GetComponent <ItemGenerator>();
     scoreItem = this.gameObject.GetComponent <ScoreItem>();
 }
Esempio n. 31
0
        public void Start()
        {
            ScoreRenderer = new ScoreItem(texturemanager);
            leftBottomBox = new LeftBottomBox(texturemanager);

            leftBottomBox = new LeftBottomBox(texturemanager);
            TitleStartBox = new GameViewComponent.TitleStartBox(texturemanager,0,220);
            TitleStartBox.BindStage(GameViewComponent.TitleStartBox.Stage1);      //绑定为Stage1

            BGMChangeBox = new GameViewComponent.BGMChangeBox(texturemanager,0,420); //绑定BGM盒
        }
Esempio n. 32
0
        private OperationReturn LoadComment(SessionInfo session, ScoreItem scoreItem)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string     rentToken  = session.RentInfo.Token;
                ScoreSheet scoreSheet = scoreItem.ScoreSheet;
                if (scoreSheet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("ScoreSheet is null");
                    return(optReturn);
                }
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    strSql =
                        string.Format(
                            "SELECT * FROM T_31_004_{0} WHERE C002 = {1} AND C003 = {2}",
                            rentToken,
                            scoreItem.ID,
                            scoreSheet.ID);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql =
                        string.Format(
                            "SELECT * FROM T_31_004_{0} WHERE C002 = {1} AND C003 = {2}",
                            rentToken,
                            scoreItem.ID,
                            scoreSheet.ID);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("DBType invalid");
                    return(optReturn);
                }
                if (objDataSet == null || objDataSet.Tables.Count <= 0)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null or DataTables empty");
                    return(optReturn);
                }
                List <Comment> listComments = new List <Comment>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = objDataSet.Tables[0].Rows[i];
                    Comment comment;
                    int     intCommentStyle = Convert.ToInt32(dr["C008"]);
                    switch (intCommentStyle)
                    {
                    case (int)CommentStyle.Text:
                        TextComment textComment = new TextComment();
                        textComment.Type        = ScoreObjectType.TextComment;
                        textComment.DefaultText = dr["C005"].ToString();
                        comment = textComment;
                        break;

                    case (int)CommentStyle.Item:
                        ItemComment itemComment = new ItemComment();
                        itemComment.Type = ScoreObjectType.ItemComment;
                        comment          = itemComment;
                        break;

                    default:
                        optReturn.Result  = false;
                        optReturn.Code    = Defines.RET_NOT_EXIST;
                        optReturn.Message = string.Format("CommentStyle not exist");
                        return(optReturn);
                    }
                    comment.Style      = (CommentStyle)intCommentStyle;
                    comment.ID         = Convert.ToInt64(dr["C001"]);
                    comment.ScoreItem  = scoreItem;
                    comment.ScoreSheet = scoreSheet;
                    comment.OrderID    = Convert.ToInt32(dr["C004"]);
                    comment.Title      = dr["C009"].ToString();

                    #region 样式

                    OperationReturn styleReturn;
                    styleReturn = LoadVisualStyle(session, comment, "T");
                    if (!styleReturn.Result)
                    {
                        if (styleReturn.Code != Defines.RET_NOT_EXIST)
                        {
                            return(styleReturn);
                        }
                        comment.TitleStyle = null;
                    }
                    else
                    {
                        VisualStyle style = styleReturn.Data as VisualStyle;
                        if (style != null)
                        {
                            style.ScoreSheet   = scoreSheet;
                            comment.TitleStyle = style;
                        }
                    }

                    styleReturn = LoadVisualStyle(session, comment, "P");
                    if (!styleReturn.Result)
                    {
                        if (styleReturn.Code != Defines.RET_NOT_EXIST)
                        {
                            return(styleReturn);
                        }
                        comment.PanelStyle = null;
                    }
                    else
                    {
                        VisualStyle style = styleReturn.Data as VisualStyle;
                        if (style != null)
                        {
                            style.ScoreSheet   = scoreSheet;
                            comment.PanelStyle = style;
                        }
                    }

                    #endregion


                    #region 子项

                    var temp = comment as ItemComment;
                    if (temp != null)
                    {
                        OperationReturn commentItemReturn;
                        commentItemReturn = LoadCommentItem(session, temp);
                        if (!commentItemReturn.Result)
                        {
                            return(commentItemReturn);
                        }
                        List <CommentItem> listItems = commentItemReturn.Data as List <CommentItem>;
                        if (listItems == null)
                        {
                            commentItemReturn.Result  = false;
                            commentItemReturn.Code    = Defines.RET_OBJECT_NULL;
                            commentItemReturn.Message = string.Format("ListCommentItems is null");
                            return(commentItemReturn);
                        }
                        for (int j = 0; j < listItems.Count; j++)
                        {
                            temp.ValueItems.Add(listItems[j]);
                        }
                        temp.ValueItems = temp.ValueItems.OrderBy(j => j.OrderID).ToList();
                    }


                    #endregion

                    listComments.Add(comment);
                }
                optReturn.Data = listComments;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Esempio n. 33
0
 public void Add(ScoreItem si)
 {
     scores.Add (si);
 }
Esempio n. 34
0
    private List<ScoreItem> CompileLists(List<string> hitList, List<string> savedList)
    {
        List<ScoreItem> scoreLists = new List<ScoreItem>();

        bool shouldCreateNewItem= true;
        foreach (string hit in hitList)
        {
            foreach (ScoreItem item in scoreLists)
            {
                if (hit == item.name)
                {
                    item.AddAmount();
                    item.AddHit();
                    shouldCreateNewItem= false;
                    break;
                }

            }
            if (shouldCreateNewItem)
            {
                ScoreItem newItem = new ScoreItem(hit);
                scoreLists.Add(newItem);
                newItem.AddHit();
            }
            shouldCreateNewItem = true;
        }

        shouldCreateNewItem = true;

        foreach (string saved in savedList)
        {
            foreach (ScoreItem item in scoreLists)
            {
                if (saved == item.name)
                {
                    item.AddAmount();
                    item.AddSaved();
                    shouldCreateNewItem= false;
                    break;
                }

            }
            if (shouldCreateNewItem)
            {
                ScoreItem newItem = new ScoreItem(saved);
                scoreLists.Add(newItem);
                newItem.AddSaved();
            }
            shouldCreateNewItem = true;
        }

        return scoreLists;
    }
Esempio n. 35
0
        Particle.Particles _Particles; //粒子效果

        #endregion Fields

        #region Constructors

        public GameView(TextureManager _t, SoundManagerEx _s , int level , Player p)
        {
            texturemanager = _t;
            soundmanager = _s;
            rendererlevel = level;
            this.player = p;
            GameEntityRenderer = Stage1State._renderer;          //获取控制器处的renderer
            // _Particles = new Particle.FlyingFlowersParticles(texturemanager);
            ScoreRenderer = new ScoreItem(_t);

            leftBottomBox = new LeftBottomBox(texturemanager);
            TitleStartBox = new GameViewComponent.TitleStartBox(texturemanager);
            BGMChangeBox = new GameViewComponent.BGMChangeBox(texturemanager);
        }
Esempio n. 36
0
        private OperationReturn LoadScoreSheet(SessionInfo session, string scoreSheetID, string scoreID)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string  rentToken = session.RentInfo.Token;
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    strSql =
                        string.Format(
                            "SELECT * FROM T_31_001_{0} WHERE C001 = {1}",
                            rentToken,
                            scoreSheetID);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql =
                        string.Format(
                            "SELECT * FROM T_31_001_{0} WHERE C001 = {1}",
                            rentToken,
                            scoreSheetID);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("DBType invalid");
                    return(optReturn);
                }
                if (objDataSet == null || objDataSet.Tables.Count <= 0)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null or DataTables empty");
                    return(optReturn);
                }
                if (objDataSet.Tables[0].Rows.Count <= 0)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_NOT_EXIST;
                    optReturn.Message = string.Format("ScoreSheet not exist");
                    return(optReturn);
                }
                DataRow    dr         = objDataSet.Tables[0].Rows[0];
                ScoreSheet scoreSheet = new ScoreSheet();
                scoreSheet.Type          = ScoreObjectType.ScoreSheet;
                scoreSheet.ScoreSheet    = scoreSheet;
                scoreSheet.ID            = Convert.ToInt64(dr["C001"]);
                scoreSheet.Title         = dr["C002"].ToString();
                scoreSheet.ViewClassic   = dr["C003"].ToString() == "C" ? ScoreItemClassic.Table : ScoreItemClassic.Tree;
                scoreSheet.TotalScore    = Convert.ToDouble(dr["C004"]);
                scoreSheet.Creator       = Convert.ToInt64(dr["C005"]);
                scoreSheet.CreateTime    = Convert.ToDateTime(dr["C006"]);
                scoreSheet.DateFrom      = Convert.ToDateTime(dr["C009"]);
                scoreSheet.DateTo        = Convert.ToDateTime(dr["C010"]);
                scoreSheet.QualifiedLine = Convert.ToDouble(dr["C011"]);
                scoreSheet.ScoreType     = dr["C014"].ToString() == "F"
                    ? ScoreType.YesNo
                    : dr["C014"].ToString() == "P" ? ScoreType.Pecentage : ScoreType.Numeric;
                scoreSheet.UseTag            = Convert.ToInt32(dr["C017"]);
                scoreSheet.Description       = dr["C019"].ToString();
                scoreSheet.CalAdditionalItem = dr["C020"].ToString() != "N";
                scoreSheet.UsePointSystem    = dr["C021"].ToString() != "N";
                string strScoreWidth = dr["C101"].ToString();
                string strTipWidth = dr["C102"].ToString();
                double intScoreWidth, intTipWidth;
                if (double.TryParse(strScoreWidth, out intScoreWidth))
                {
                    scoreSheet.ScoreWidth = intScoreWidth;
                }
                if (double.TryParse(strTipWidth, out intTipWidth))
                {
                    scoreSheet.TipWidth = intTipWidth;
                }
                scoreSheet.HasAutoStandard  = dr["C103"].ToString() != "N";
                scoreSheet.AllowModifyScore = dr["C104"].ToString() != "N";

                #region 子项
                if (scoreID == "0")
                {
                    scoreID = string.Empty;
                }
                else
                {
                    scoreID = string.Format(" AND T3109.C003={0}", scoreID);
                }
                //加载子项
                optReturn = LoadScoreItem(session, scoreSheet, scoreID);
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                List <ScoreItem> listItems = optReturn.Data as List <ScoreItem>;
                if (listItems == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("ListItems is null");
                    return(optReturn);
                }
                for (int i = 0; i < listItems.Count; i++)
                {
                    ScoreItem scoreItem = listItems[i];
                    scoreSheet.Items.Add(scoreItem);
                }
                scoreSheet.Items = scoreSheet.Items.OrderBy(i => i.OrderID).ToList();

                #endregion 子项


                #region 样式

                OperationReturn styleReturn;
                styleReturn = LoadVisualStyle(session, scoreSheet, "T");
                if (!styleReturn.Result)
                {
                    if (styleReturn.Code != Defines.RET_NOT_EXIST)
                    {
                        return(styleReturn);
                    }
                    scoreSheet.TitleStyle = null;
                }
                else
                {
                    VisualStyle style = styleReturn.Data as VisualStyle;
                    if (style != null)
                    {
                        style.ScoreSheet      = scoreSheet;
                        scoreSheet.TitleStyle = style;
                    }
                }

                styleReturn = LoadVisualStyle(session, scoreSheet, "P");
                if (!styleReturn.Result)
                {
                    if (styleReturn.Code != Defines.RET_NOT_EXIST)
                    {
                        return(styleReturn);
                    }
                    scoreSheet.PanelStyle = null;
                }
                else
                {
                    VisualStyle style = styleReturn.Data as VisualStyle;
                    if (style != null)
                    {
                        style.ScoreSheet      = scoreSheet;
                        scoreSheet.PanelStyle = style;
                    }
                }

                #endregion


                #region 备注

                OperationReturn commentReturn;
                commentReturn = LoadComment(session, scoreSheet);
                if (!commentReturn.Result)
                {
                    return(commentReturn);
                }
                List <Comment> listComments = commentReturn.Data as List <Comment>;
                if (listComments == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("listComments is null");
                    return(optReturn);
                }
                for (int i = 0; i < listComments.Count; i++)
                {
                    Comment comment = listComments[i];
                    scoreSheet.Comments.Add(comment);
                }
                scoreSheet.Comments = scoreSheet.Comments.OrderBy(j => j.OrderID).ToList();

                #endregion


                #region 控制项

                OperationReturn controlReturn;
                controlReturn = LoadControlItem(session, scoreSheet);
                if (!controlReturn.Result)
                {
                    return(controlReturn);
                }
                List <ControlItem> listControlItems = controlReturn.Data as List <ControlItem>;
                if (listControlItems == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("ListCotnrolItems is null");
                    return(optReturn);
                }
                for (int i = 0; i < listControlItems.Count; i++)
                {
                    ControlItem controlItem = listControlItems[i];
                    scoreSheet.ControlItems.Add(controlItem);
                }
                scoreSheet.ControlItems = scoreSheet.ControlItems.OrderBy(j => j.OrderID).ToList();
                #endregion

                optReturn.Data = scoreSheet;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }