// These are temporary false return values
        // for use while implementing the the PatternArrayView
        public int numberOfRows(PatternArrayView view)
        {
            if (controller_ == null)
                return 0;

            PatternArrayController pac = controller_.targetObject as PatternArrayController;
            return pac.numberOfRows();
        }
        public bool firstColumnIsEven(PatternArrayView view)
        {
            if (controller_ == null)
                return true; // Value won't be used, but needs to return something

            PatternArrayController pac = controller_.targetObject as PatternArrayController;
            return pac.colsLeft() % 2 == 0;
        }
Пример #3
0
        public FreePatternStoreEditor()
        {
            storesDict_ = new Dictionary<string, FreePatternStore>();
            fileStates_ = new Dictionary<string, FileState>();

            patternView_ = new PatternArrayView(this);
            // Register for click input
            patternView_.responder = this;

            // Setup cellpainting palette
            // Collect possible values excluding undefined
            cellTypes_     = (from CellType ct in Enum.GetValues(typeof(CellType))
                              where (ct != CellType.Undefined)
                              select ct).ToArray();
            cellTypeNames_ = (from CellType ct in cellTypes_
                              select Enum.GetName(typeof(CellType), ct)).ToArray();
            leftClickCellTypeIndex_  = (int)Array.IndexOf<CellType>(cellTypes_, CellType.Normal);
            rightClickCellTypeIndex_ = (int)Array.IndexOf<CellType>(cellTypes_, CellType.Empty);
        }
Пример #4
0
 public bool firstColumnIsEven(PatternArrayView view)
 {
     return true;
 }
Пример #5
0
 public void cellRightClicked(PatternArrayView view, int col, int row)
 {
     setType(cellTypes_[rightClickCellTypeIndex_], col, row);
 }
Пример #6
0
        public CellType typeForCell(PatternArrayView view, int col, int row)
        {
            if (serializedTarget_ == null)
                return CellType.Undefined;

            FreePatternStore store = serializedTarget_.targetObject as FreePatternStore;

            // Check bounds
            if (   col >= 0 && col < store.width
                && row >= 0 && row < store.height)
                return store[col, row];
            else
                return CellType.Undefined;
        }
Пример #7
0
        public int numberOfRows(PatternArrayView view)
        {
            if (serializedTarget_ == null)
                return 0;

            FreePatternStore store = serializedTarget_.targetObject as FreePatternStore;
            return store.height;
        }
Пример #8
0
        public int numberOfColumns(PatternArrayView view)
        {
            if (serializedTarget_ == null)
                return 0;

            FreePatternStore store = serializedTarget_.targetObject as FreePatternStore;
            return store.width;
        }
        // Instead of instantiation
        public void OnEnable()
        {
            // Create new level if none selected
            if (controller_ == null) {
                PatternArrayController pac = ScriptableObject.CreateInstance<PatternArrayController>();
                setController(pac);
            }

            // Populate CellPattern subclass list
            var subclasses = typeof(CellPattern).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(CellPattern)));
            patternClassNames_ = (from sc in subclasses select sc.Name).ToArray();

            storeEditor_ = new FreePatternStoreEditor();
            patView_ = new PatternArrayView(this);
        }
Пример #10
0
 public int numberOfColumns(PatternArrayView view)
 {
     PatternArrayController pac = controller_.targetObject as PatternArrayController;
     return pac.numberOfColumns();
 }
Пример #11
0
        public CellType typeForCell(PatternArrayView view, int col, int row)
        {
            if (controller_ == null)
                return CellType.Undefined;

            PatternArrayController pac = controller_.targetObject as PatternArrayController;
            col += pac.colsLeft();
            return pac.typeAtCoor(new PatternCoordinate(col, row));
        }