Esempio n. 1
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(instance.gameObject);
     }
     instance = this;
 }
Esempio n. 2
0
        public void InitializeSpells()
        {
            SpellsTab.ClearChildren();

            /*
             * ScrollView scroller = new ScrollView(GUI, SpellsTab)
             * {
             *  HeightSizeMode = SizeMode.Fit,
             *  WidthSizeMode = SizeMode.Fit
             * };
             *
             * List<Spell> spells = Master.Spells.GetKnownSpells();
             *
             * if (spells.Count == 0) return;
             * int numCols = 4;
             * int numRows = Math.Max(spells.Count / numCols, 1);
             * GridLayout spellLayout = new GridLayout(GUI, scroller, numRows, numCols)
             * {
             *  HeightSizeMode = SizeMode.Fixed,
             *  WidthSizeMode = SizeMode.Fixed,
             *  LocalBounds = new Rectangle(0, 0, numCols * 48, numRows * 48)
             * };
             *
             * int i = 0;
             * foreach (Spell spell in spells)
             * {
             *  int row = i / numCols;
             *  int col = i % numCols;
             *
             *
             *  Button imageButton = new Button(GUI, spellLayout, spell.Name, GUI.SmallFont,
             *      Button.ButtonMode.ImageButton, spell.Image)
             *  {
             *      ToolTip = spell.Description
             *  };
             *  Spell toTrigger = spell;
             *  imageButton.OnClicked += () => SpellClicked(toTrigger);
             *
             *  spellLayout.SetComponentPosition(imageButton, col, row, 1, 1);
             *  i++;
             * }
             * spellLayout.UpdateSizes();
             */
            SetupSpellTab();
        }