//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Accessors and Mutators //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- public void OnGUI() { Rect rect = new Rect(Screen.width - 180, 0, 180, Screen.height); int oldIndex = index; index = DrawList(rect, index, blockSet.Blocks, ref scrollPosition); if (oldIndex != index) { BuildBlock(blockSet.GetBlock(index)); } }
private static OpenCog.BlockSet.BaseBlockSet.OCBlock DrawInventory(OpenCog.BlockSet.OCBlockSet blockSet, ref UnityEngine.Vector2 scrollPosition, OpenCog.BlockSet.BaseBlockSet.OCBlock selected) { scrollPosition = GUILayout.BeginScrollView(scrollPosition); for (int i = 0, y = 0; i < blockSet.BlockCount; y++) { GUILayout.BeginHorizontal(); for (int x = 0; x < 8; x++, i++) { OpenCog.BlockSet.BaseBlockSet.OCBlock block = blockSet.GetBlock(i); if (DrawBlock(block, block == selected && selected != null)) { selected = block; } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); return(selected); }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Accessors and Mutators //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- public void SetBlockSet(OpenCog.BlockSet.OCBlockSet blockSet) { this.blockSet = blockSet; index = Mathf.Clamp(index, 0, blockSet.BlockCount); BuildBlock( blockSet.GetBlock(index) ); }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Accessors and Mutators //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- public void SetBlockSet(OpenCog.BlockSet.OCBlockSet blockSet) { this.blockSet = blockSet; index = Mathf.Clamp(index, 0, blockSet.BlockCount); BuildBlock(blockSet.GetBlock(index)); }