public void freeInode(int inodeNumber) { foreach (int block in inodes.Find((x) => x.inodeNumber == inodeNumber).allocatedBlocks) { FileManagerGameMaster.getBlock(block).deReference(); } }
public void allocateFile(int startSize) { int inode = findFreeInodeIndex(); if (inode == -1) { noFreeInodeError(); return; } int amountDataBlocksNeeded = Mathf.CeilToInt((float)startSize / blockSize); List <int> foundBlocks = getFreeDataBlocks(amountDataBlocksNeeded); if (foundBlocks.Count < amountDataBlocksNeeded) { notEnoughSpaceError(); return; } int sizeCounter = startSize; foreach (int b in foundBlocks) { FileManagerGameMaster.getBlock(b).setAsAllocated(Mathf.Min(sizeCounter, blockSize)); sizeCounter -= blockSize; } bitmapInode.Add(inode); bitmapData.AddRange(foundBlocks); setInodeInformation(inode, foundBlocks, startSize); UIOverlord.dataChanged(); }
void Start() { singleton = this; initStartBlocks(160); gameLogic.init(160); selector.setStartSelect(sections [0].getBlock(0)); }
private void allocateInodeBlocks(int startIndex, int amount) { for (int i = 0; i < amount; i++) { FileManagerGameMaster.getBlock(startIndex + i).setAsInodeBlock(inodeCounter); inodes.Add(FileManagerGameMaster.getBlock(startIndex + i)); inodeCounter += 16; } }
public void init(int blockAmount) { this.totalBlockAmount = blockAmount; FileManagerGameMaster.getBlock(0).setState(BlockState.SuperBlock); FileManagerGameMaster.getBlock(1).setState(BlockState.BitmapInode); FileManagerGameMaster.getBlock(2).setState(BlockState.BitmapData); allocateInodeBlocks(3, 5); this.systemSize = blockAmount * (blockSize - 8); inodeStartIndex = 3; dataStartIndex = 8; }
public void OnPointerExit(PointerEventData eventData) { if (isOver == false) { return; } isOver = false; foreach (int i in info.allocatedBlocks) { FileManagerGameMaster.getBlock(i).deReference(); } }
public void OnPointerEnter(PointerEventData eventData) { if (isOver) { return; } isOver = true; foreach (int i in info.allocatedBlocks) { FileManagerGameMaster.getBlock(i).reference(); } }
public void removeFile(int inodeNumber) { bitmapInode.Remove(inodeNumber); FileManagerBlock inodeBlock = getMatchingInodeBlock(inodeNumber); inodeBlock.freeInode(inodeNumber); foreach (int block in inodeBlock.getInodeInformation(inodeNumber).allocatedBlocks) { FileManagerGameMaster.getBlock(block).setState(BlockState.Empty); bitmapData.Remove(block); } InodeInformation newInfo = new InodeInformation(inodeNumber); getMatchingInodeBlock(inodeNumber).setInodeInformation(inodeNumber, newInfo); UIOverlord.dataChanged(); }
public void setState(BlockState newState) { state = newState; theRenderer.color = FileManagerGameMaster.getStateColor(newState); //Logos get to pixelated /* * Blogo.SetActive (false); * Dlogo.SetActive (false); * Ilogo.SetActive (false); * Slogo.SetActive (false); * * if (newState == BlockState.SuperBlock) * Slogo.SetActive (true); * else if (newState == BlockState.Inode) * Ilogo.SetActive (true); * else if (newState == BlockState.BitmapData) * Blogo.SetActive (true); * else * Dlogo.SetActive (true); */ }
private FileManagerBlock getMatchingInodeBlock(int inodeNumber) { int blockOffset = inodeNumber / inodesInBlock; return(FileManagerGameMaster.getBlock(inodeStartIndex + blockOffset)); }