Ejemplo n.º 1
0
        // 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();
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public bool firstColumnIsEven(PatternArrayView view)
 {
     return true;
 }
Ejemplo n.º 5
0
 public void cellRightClicked(PatternArrayView view, int col, int row)
 {
     setType(cellTypes_[rightClickCellTypeIndex_], col, row);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 7
0
        public int numberOfRows(PatternArrayView view)
        {
            if (serializedTarget_ == null)
                return 0;

            FreePatternStore store = serializedTarget_.targetObject as FreePatternStore;
            return store.height;
        }
Ejemplo n.º 8
0
        public int numberOfColumns(PatternArrayView view)
        {
            if (serializedTarget_ == null)
                return 0;

            FreePatternStore store = serializedTarget_.targetObject as FreePatternStore;
            return store.width;
        }
Ejemplo n.º 9
0
        // 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);
        }
Ejemplo n.º 10
0
 public int numberOfColumns(PatternArrayView view)
 {
     PatternArrayController pac = controller_.targetObject as PatternArrayController;
     return pac.numberOfColumns();
 }
Ejemplo n.º 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));
        }