Пример #1
0
    private void SetPlayerDeckList()
    {
        string[] deckNames = Directory.GetFiles("Deck");

        bool bAddDummy = false;
        int len = deckNames.Length;
        if(len == 0)
        {
            bAddDummy = true;
            len++;
        }

        decklist = new PopupList((int)(_xAvatar + 128 - 100), (int)(_y + settingsBackground.height - 50), 200, 20, 8);
        for(int i = 0; i < deckNames.Length; i++)
        {
            decklist.Add(deckNames[i].Substring(5, deckNames[i].Length - 5 - 4));
        }

        if(bAddDummy)
        {
            decklist.Add("No deck");
        }

        string defaultDeck = PlayerPrefs.GetString("DefaultDeck");

        if(defaultDeck != "")
        {
            decklist.SelectOptionWithValue(defaultDeck);
        }
    }
    public DeckInformation(float x, float y, DeckEditorManager deck)
    {
        restrictedList = new RCL_Official();
        restrictedList.SetDeckInformation(this);

        CardList = new int[Enum.GetNames(typeof(CardIdentifier)).Length];
        CardLimit = new int[Enum.GetNames(typeof(CardIdentifier)).Length];

        for(int i = 0; i < CardList.Length; i++)
        {
            CardList[i] = 0;
            CardLimit[i] = 4;
        }

        CardLimit[(int)CardIdentifier.MASS_PRODUCTION_SAILOR] = 16;

        _DeckEditor = deck;

        xCorr = _DeckEditor._xWindowScale;
        yCorr = _DeckEditor._yWindowScale;

        textStyle = new GUIStyle();
        textStyle.fontSize = (int)(15  * xCorr);
        textStyle.normal.textColor = Color.white;

        _x = x;
        _y = y;
        _Background = Resources.Load ("DeckEditor/DeckInformation") as Texture2D;

        if(!Directory.Exists("Deck"))
        {
            Directory.CreateDirectory("Deck");
        }

        string[] deckNames = Directory.GetFiles("Deck");

        bool bAddDummy = false;
        int len = deckNames.Length;
        if(len == 0)
        {
            bAddDummy = true;
            len++;
        }

        decklist = new PopupList((int)(_x + (15.0f + 230.0f)), (int)(_y + (40.0f)), 200, 20, 5);
        //decklist.SetSliderYFactor((16.8f/24.0f) * decklist.GetNumOptions());

        for(int i = 0; i < deckNames.Length; i++)
        {
            decklist.Add(deckNames[i].Substring(5, deckNames[i].Length - 5 - 4));
            Debug.Log (deckNames[i].Substring(5, deckNames[i].Length - 5 - 4));
        }

        if(bAddDummy)
        {
            decklist.Add("No deck");
        }

        string defaultDeck = PlayerPrefs.GetString("DefaultDeck");

        if(defaultDeck != "")
        {
            decklist.SelectOptionWithValue(defaultDeck);
        }

        _DeckEditor.DeckName = decklist.GetValue();
        //decklist.GetValue();
    }