Ejemplo n.º 1
0
    /// <summary>
    /// Called when a card is picked by the player
    /// </summary>
    /// <param name="card">The Card picked</param>
    public void OnCardPicked(CardType card)
    {
        handCards.Remove(card);
        Vector3 position = distanceBetweenScoreGroup;

        //Create the PlayingCard prefab to bring the card into 3D space
        playingCard = Instantiate(Deck.Instance().playingCardPrefab, handPosition.transform).GetComponent <PlayedCard>();
        playingCard.ApplyCard(Deck.Instance().deckInfo.byType(card));
        //pause the playing card, we will hold it in midair until everyone has picked a card
        playingCard.Pause();
        ScoreGroup foundGroup = null;

        foreach (ScoreGroup group in GetComponentsInChildren <ScoreGroup>())
        {
            if (group.CanPlayOnGroup(card))
            {
                foundGroup = group;
                break;
            }
            else
            {
                position = (new Vector3(group.transform.localPosition.x, 0, 0)) + distanceBetweenScoreGroup;
            }
        }
        if (!foundGroup)
        {
            foundGroup = CreateNewScoreGroupForCard(card, position);
        }
        playingCard.SetMoveRequest(foundGroup.GetNextCardMoveRequest());
        if (evtCardChosen != null)
        {
            evtCardChosen(this);
        }
        PassCardPack();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Creates a new Scoregroup for the given card
    /// </summary>
    /// <param name="card">The Card for the new scoregroup</param>
    /// <param name="localPosition">The position for the new scoreGroup</param>
    /// <returns>The new Scoregroup</returns>
    protected ScoreGroup CreateNewScoreGroupForCard(CardType card, Vector3 localPosition)
    {
        GameObject gameobj = new GameObject("ScoreGroup");

        gameobj.transform.SetParent(transform);
        gameobj.transform.localPosition = localPosition;
        gameobj.transform.localRotation = Quaternion.identity;
        switch (card)
        {
        case CardType.Roll_Single:
        case CardType.Roll_Double:
        case CardType.Roll_Triple:
            gameobj.AddComponent <RollScoreGroup>();
            break;

        case CardType.Dumpling:
            gameobj.AddComponent <DumplingScoreGroup>();
            break;

        case CardType.Nigiri_Squid:
        case CardType.Nigiri_Salmon:
        case CardType.Nigiri_Egg:
            gameobj.AddComponent <NigiriScoreGroup>();
            break;

        case CardType.Wasabi:
            gameobj.AddComponent <WasabiScoreGroup>();
            break;

        case CardType.Sashimi:
            gameobj.AddComponent <SashimiScoreGroup>();
            break;

        case CardType.Tempura:
            gameobj.AddComponent <TempuraScoreGroup>();
            break;

        case CardType.Pudding:
            gameobj.AddComponent <PuddingScoreGroup>();
            break;

        default:
            gameobj.AddComponent <GenericScoreGroup>();
            break;
        }
        ScoreGroup group = gameobj.GetComponent <ScoreGroup>();

        //Add our scorecard to the group
        group.SetScoreCard(scoreCard);
        //Add particle system if exists
        if (cardPlayParticleSystem != null)
        {
            group.SetParticleSystem(cardPlayParticleSystem);
        }
        //Connect our eventListener to the scoregroup
        group.evtCardPlayed += this.OnCardPlayed;
        return(group);
    }
Ejemplo n.º 3
0
 private void CreateItems()
 {
     if (ScoreSheet != null)
     {
         mListScoreItems.Clear();
         for (int i = 0; i < ScoreSheet.Items.Count; i++)
         {
             ScoreItem  item       = ScoreSheet.Items[i];
             ScoreGroup scoreGroup = item as ScoreGroup;
             if (scoreGroup != null)
             {
                 ScoreGroupViewer scoreGroupViewer = new ScoreGroupViewer();
                 scoreGroupViewer.ScoreGroup  = scoreGroup;
                 scoreGroupViewer.Settings    = Settings;
                 scoreGroupViewer.Languages   = Languages;
                 scoreGroupViewer.LangID      = LangID;
                 scoreGroupViewer.ViewClassic = ViewClassic;
                 scoreGroupViewer.ViewMode    = ViewMode;
                 if (ViewClassic == ScoreItemClassic.Table)
                 {
                     if (i > 0)
                     {
                         scoreGroupViewer.BorderThickness = new Thickness(1, 1, 0, 0);
                     }
                     else
                     {
                         scoreGroupViewer.BorderThickness = new Thickness(0, 1, 0, 0);
                     }
                 }
                 mListScoreItems.Add(scoreGroupViewer);
             }
             Standard standard = item as Standard;
             if (standard != null)
             {
                 StandardViewer standardViewer = new StandardViewer();
                 standardViewer.Standard    = standard;
                 standardViewer.Settings    = Settings;
                 standardViewer.Languages   = Languages;
                 standardViewer.LangID      = LangID;
                 standardViewer.ViewClassic = ViewClassic;
                 standardViewer.ViewMode    = ViewMode;
                 if (ViewClassic == ScoreItemClassic.Table)
                 {
                     if (i > 0)
                     {
                         standardViewer.BorderThickness = new Thickness(1, 1, 0, 0);
                     }
                     else
                     {
                         standardViewer.BorderThickness = new Thickness(0, 1, 0, 0);
                     }
                 }
                 mListScoreItems.Add(standardViewer);
             }
         }
     }
 }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
    /// <summary>
    /// Calculates the approximate value of a card from the perspective of this turn
    /// Can take into account future cards played on this card
    /// </summary>
    /// <param name="card">The card to calculate</param>
    /// <returns>Approx value of card as a float</returns>
    private float GetValueForCard(CardType card)
    {
        switch (card)
        {
        case CardType.Roll_Single:
        case CardType.Roll_Double:
        case CardType.Roll_Triple:
        {
            //get our current roll score
            int oldRollsScore = this._player.scoreCard.GetRollsPotentialScore();
            //Ask the scorecard to get us a predictor based on the new card value
            IRollScorer        scorer  = this._player.scoreCard.MakeRollsPredictor(card);
            List <IRollScorer> scorers = new List <IRollScorer> {
                scorer
            };
            //We want to add the opponents in because roll scores are relative to the other players
            //These Predictor scorers are read-only, meaning that pushing them through the UpdateRollScores()
            //function does not update the players' actual scores
            foreach (IRollScorer opScorer in Deck.Instance().GetOpponentPredictorScorers(this._player))
            {
                scorers.Add(opScorer);
            }
            //calculate the new potential scores
            scorers.UpdateRollScores();
            float value = scorer.GetRollsPotentialScore() - oldRollsScore;
            if (UnityEngine.Random.Range(0, 1.0f) > 0.5f)
            {
                //account for multiple people playing rolls on the same turn
                //without this the AI would always play rolls on the first turn
                //clobbering each other
                value *= 0.5f;
            }
            return(value);
        }

        case CardType.Dumpling:
        {
            //dumplings are based on how many you've played already
            int maxPossiblePlayable = counter.MaxCopiesPlayableThisRound(card);
            //value of the first card played (presumably this turn's card)
            int        startingCard = 1;
            int        count        = 0;
            float      value        = 0.0f;
            ScoreGroup sg           = GetActiveScoreGroup <DumplingScoreGroup>(card);
            if (sg != null)
            {
                startingCard += sg.CardCount();
            }
            //used to calculate the cards that can be played and their total value
            int countto = maxPossiblePlayable + startingCard - 1;
            //dumplings aren't worth anything passed 5
            if (countto > 5)
            {
                countto = 5;
            }
            for (int i = startingCard; i <= countto; i++)
            {
                value += i;
                count++;
            }
            return(count == 0 ? 0 : value / (float)count);
        }

        case CardType.Nigiri_Squid:
        case CardType.Nigiri_Salmon:
        case CardType.Nigiri_Egg:
        {
            //If there's a wasabi, we're playing on it
            WasabiScoreGroup sg = GetActiveScoreGroup <WasabiScoreGroup>(card);
            if (sg)
            {
                return(ScoreCard.NigiriValues[card] * 3.0f);
            }
            //Otherwise just value of current nigiri
            return(ScoreCard.NigiriValues[card]);
        }

        case CardType.Wasabi:
        {
            foreach (var nigiri in ScoreCard.NigiriValues.OrderByDescending(r => r.Value))
            {
                //check card counter for every type of nigiri, starting with the most valued.
                //divide potential value by 2, as it would take 2 cards to get this potential score
                if (counter.MaxCopiesPlayableThisRound(nigiri.Key) > 0)
                {
                    return((nigiri.Value * 3.0f) / 2);
                }
            }
            return(0.0f);
        }

        case CardType.Sashimi:
        {
            int sashimiRemaining = 3;
            SashimiScoreGroup sg = GetActiveScoreGroup <SashimiScoreGroup>(card);
            //If we've already started, count the sashimi we already have
            if (sg)
            {
                sashimiRemaining -= sg.CardCount();
            }
            //make sure we will be able to play sashimi after this
            if (counter.MaxCopiesPlayableThisRound(card) >= sashimiRemaining)
            {
                return(10.0f / sashimiRemaining);
            }
            //We won't be able to finish this sashimi, don't bother
            return(0.0f);
        }

        case CardType.Tempura:
        {
            int tempuraRemaining = 2;
            TempuraScoreGroup sg = GetActiveScoreGroup <TempuraScoreGroup>(card);
            //If we've already started, count the sashimi we already have
            if (sg)
            {
                tempuraRemaining -= sg.CardCount();
            }
            //make sure we will be able to play tempura after this
            if (counter.MaxCopiesPlayableThisRound(card) >= tempuraRemaining)
            {
                return(5.0f / tempuraRemaining);
            }
            //We won't be able to finish this tempura, don't bother
            return(0.0f);
        }

        case CardType.Pudding:
        {
            //get our current pudding score
            int oldPuddingScore = this._player.scoreCard.GetPuddingPotentialScore();
            //Ask the scorecard to get us a predictor based on the new card value
            IPuddingScorer        scorer  = this._player.scoreCard.MakePuddingPredictor(1);
            List <IPuddingScorer> scorers = new List <IPuddingScorer>()
            {
                scorer
            };
            //We want to add the opponents in because pudding scores are relative to the other players
            //These Predictor scorers are read-only, meaning that pushing them through the UpdatePuddingScores()
            //function does not update the players' actual scores
            foreach (IPuddingScorer opScorer in Deck.Instance().GetOpponentPredictorScorers(this._player))
            {
                scorers.Add(opScorer);
            }
            //calculate new potential scores
            scorers.UpdatePuddingScores();
            //we don't need to do since AI clobbering puddings doesn't appear to be a problem
            return(scorer.GetPuddingPotentialScore() - oldPuddingScore);
        }

        default:
        {
            return(0.0f);
        }
        }
    }
Ejemplo n.º 7
0
        private void CreateScoreObject()
        {
            PanelScoreObjects.Children.Clear();
            if (ScoreObject != null)
            {
                ScoreSheet scoreSheet;
                switch (ScoreObject.Type)
                {
                case ScoreObjectType.ScoreSheet:
                    scoreSheet = ScoreObject as ScoreSheet;
                    if (scoreSheet != null)
                    {
                        ScoreSheetViewer scoreSheetViewer = new ScoreSheetViewer();
                        scoreSheetViewer.ScoreSheet  = scoreSheet;
                        scoreSheetViewer.Settings    = Settings;
                        scoreSheetViewer.Languages   = Languages;
                        scoreSheetViewer.LangID      = LangID;
                        scoreSheetViewer.ViewClassic = scoreSheet.ViewClassic;
                        PanelScoreObjects.Children.Add(scoreSheetViewer);
                    }
                    break;

                case ScoreObjectType.ScoreGroup:
                    ScoreGroup scoreGroup = ScoreObject as ScoreGroup;
                    if (scoreGroup != null)
                    {
                        scoreSheet = scoreGroup.ScoreSheet;
                        ScoreGroupViewer scoreGroupViewer = new ScoreGroupViewer();
                        scoreGroupViewer.ScoreGroup  = scoreGroup;
                        scoreGroupViewer.Settings    = Settings;
                        scoreGroupViewer.ViewClassic = scoreGroup.ViewClassic;
                        if (scoreSheet != null)
                        {
                            scoreGroupViewer.ViewClassic = scoreSheet.ViewClassic;
                        }
                        scoreGroupViewer.Languages = Languages;
                        scoreGroupViewer.LangID    = LangID;
                        PanelScoreObjects.Children.Add(scoreGroupViewer);
                    }
                    break;

                case ScoreObjectType.NumericStandard:
                case ScoreObjectType.YesNoStandard:
                case ScoreObjectType.ItemStandard:
                case ScoreObjectType.SliderStandard:
                    Standard standard = ScoreObject as Standard;
                    if (standard != null)
                    {
                        scoreSheet = standard.ScoreSheet;
                        StandardViewer standardViewer = new StandardViewer();
                        standardViewer.ViewClassic = standard.ViewClassic;
                        if (scoreSheet != null)
                        {
                            standardViewer.ViewClassic = scoreSheet.ViewClassic;
                        }
                        standardViewer.Standard  = standard;
                        standardViewer.Settings  = Settings;
                        standardViewer.Languages = Languages;
                        standardViewer.LangID    = LangID;
                        PanelScoreObjects.Children.Add(standardViewer);
                    }
                    break;

                case ScoreObjectType.StandardItem:
                    StandardItem standardItem = ScoreObject as StandardItem;
                    if (standardItem != null)
                    {
                        StandardItemViewer standardItemViewer = new StandardItemViewer();
                        standardItemViewer.StandardItem = standardItem;
                        standardItemViewer.Settings     = Settings;
                        standardItemViewer.Languages    = Languages;
                        standardItemViewer.LangID       = LangID;
                        PanelScoreObjects.Children.Add(standardItemViewer);
                    }
                    break;

                case ScoreObjectType.TextComment:
                case ScoreObjectType.ItemComment:
                    Comment comment = ScoreObject as Comment;
                    if (comment != null)
                    {
                        CommentViewer commentViewer = new CommentViewer();
                        commentViewer.Comment   = comment;
                        commentViewer.Settings  = Settings;
                        commentViewer.Languages = Languages;
                        commentViewer.LangID    = LangID;
                        PanelScoreObjects.Children.Add(commentViewer);
                    }
                    break;

                case ScoreObjectType.CommentItem:
                    CommentItem commentItem = ScoreObject as CommentItem;
                    if (commentItem != null)
                    {
                        CommentItemViewer commentItemViewer = new CommentItemViewer();
                        commentItemViewer.CommentItem = commentItem;
                        commentItemViewer.Settings    = Settings;
                        commentItemViewer.Languages   = Languages;
                        commentItemViewer.LangID      = LangID;
                        PanelScoreObjects.Children.Add(commentItemViewer);
                    }
                    break;

                case ScoreObjectType.ControlItem:
                    ControlItem controlItem = ScoreObject as ControlItem;
                    if (controlItem != null)
                    {
                        ControlItemViewer controlItemViewer = new ControlItemViewer();
                        controlItemViewer.ControlItem = controlItem;
                        controlItemViewer.Settings    = Settings;
                        controlItemViewer.Languages   = Languages;
                        controlItemViewer.LangID      = LangID;
                        PanelScoreObjects.Children.Add(controlItemViewer);
                    }
                    break;
                }
            }
        }