/* ********************************************************* */ //! Set Deep-Copy Cell /*! * @param cellMapOutput * destination CellMap * @param indexCellOutput * destination index of cell * @param cell * source Cell * @retval Return-Value * true == Success<br> * false == Failure (Error) * * Set a deep-copy of "cell" in cell of �hindexCellOutput�h in CellMap.<br> */ public static bool CopyDeep(Library_SpriteStudio6.Data.CellMap cellMapOutput, int indexCellOutput, ref Library_SpriteStudio6.Data.CellMap.Cell cell ) { return(Library_SpriteStudio6.Utility.Cell.CopyDeep(cellMapOutput, indexCellOutput, ref cell)); }
/* ********************************************************* */ //! Deep-Copy TableCellMap /*! * @param indexStart * Index of the first CellMap to copy<br> * default: 0 * @param indexEnd * Index of the last CellMap to copy<br> * default: -1 (end of TableCellMap) * @param flagInUse * true == Currently in use TableMaterial<br> * false == TableMaterial in original animation data * @retval Return-Value * New TableMaterial * * Creates a deep-copy of specified range of TableCellMap.<br> */ public Library_SpriteStudio6.Data.CellMap[] TableCopyCellMapDeep(int indexStart = 0, int indexEnd = -1, bool flagInUse = true) { Library_SpriteStudio6.Data.CellMap[] tableCellMap = TableGetCellMap(flagInUse); if (null == tableCellMap) { return(null); } if (false == IndexGetCellMapCopy(ref indexStart, ref indexEnd, tableCellMap)) { return(null); } int countCellMap = (indexEnd - indexStart) + 1; Library_SpriteStudio6.Data.CellMap[] tableCellMapCopy = new Library_SpriteStudio6.Data.CellMap[countCellMap]; if (null == tableCellMapCopy) { return(null); } for (int i = 0; i < countCellMap; i++) { tableCellMapCopy[i] = Library_SpriteStudio6.Utility.Cell.MapCopyDeep(tableCellMap[i + indexStart]); if (null == tableCellMapCopy[i]) { tableCellMapCopy = null; return(null); } } return(tableCellMapCopy); }
/* ********************************************************* */ //! Set(Change) CellMap /*! * @param indexCellMap * index of CellMap * @param cellMap * tNewly set CellMap<br> * null == Revert to initial data * @retval Return-Value * true == Success<br> * false == Failure (Error) * * Change CellMap of Currently CellMap-table in use.<br> * <br> * Attention to the following, since this function doesn't check content of CellMap.<br> * <br> * - number of cells stored in "cellMap" is need to satisfy number of cells used in animation<br> * <br> * See also the notes on "TableSetCellMap".<br> */ public bool CellMapSet(int indexCellMap, Library_SpriteStudio6.Data.CellMap cellMap) { if (null != cellMap) { /* Revert */ if (null == DataCellMap) { return(false); } if ((0 > indexCellMap) || (DataCellMap.TableCellMap.Length <= indexCellMap)) { return(false); } cellMap = DataCellMap.TableCellMap[indexCellMap]; } if (null == TableCellMap) { return(false); } if ((0 > indexCellMap) || (TableCellMap.Length <= indexCellMap)) { return(false); } TableCellMap[indexCellMap] = cellMap; Status |= FlagBitStatus.CHANGE_CELLMAP; return(true); }
/* ********************************************************* */ //! Deep-Copy Cells /*! * @param cellMapOutput * destination CellMap * @param indexCellOutput * destination index of cell * @param cellMap * source CellMap * @param indexCell * source index of cell * @param countCell * Number of Cells to be copied * @retval Return-Value * true == Success<br> * false == Failure (Error) * * Deep-copy multiple Cells from source CellMap to destination CellMap.<br> */ public static bool CopyDeep(Library_SpriteStudio6.Data.CellMap cellMapOutput, int indexCellOutput, Library_SpriteStudio6.Data.CellMap cellMap, int indexCell, int countCell ) { return(Library_SpriteStudio6.Utility.Cell.CopyDeep(cellMapOutput, indexCellOutput, cellMap, indexCell, countCell)); }
/* ----------------------------------------------- MonoBehaviour-Functions */ #region MonoBehaviour-Functions void Start() { /* Initialize WorkArea */ FlagPaddingZeroPrevious = !FlagPaddingZero; /* Since this value can not be set with initializer... */ /* Get Animation Control Script-Component */ GameObject gameObjectBase = GameObjectRoot; if (null == gameObjectBase) { gameObjectBase = gameObject; } /* MEMO: "Script_SpriteStudio6_Root.Parts.RootGet" is function for finding "Script_SpriteStudio6_Root" in GameObjects below. */ /* (However, "Instance" is excluded. Find only "Highest-Root"-parts) */ /* You can find "shallowest hierarchy"-one from direct-children, but not guarantee the shallowest when deeper than children. */ /* Because wasteful to search every time access, recommend to cache. */ ScriptRoot = Script_SpriteStudio6_Root.Parts.RootGet(gameObjectBase); if (null == ScriptRoot) { /* Error */ return; } /* Animation Start */ /* MEMO: Since animation without movement, no problem even if stops right after playing. */ /* (no problem even if does not stop too.) */ /* However, stopped animation has less CPU load than continue playing. */ /* MEMO: Since useless to search animation-index every time, recommend to cache frequently used indexes. */ int indexAnimation = ScriptRoot.IndexGetAnimation("Digit08"); if (0 > indexAnimation) { /* Animation not found */ return; } ScriptRoot.AnimationPlay(-1, indexAnimation, 1); ScriptRoot.AnimationStop(-1); /* Get Digit-Parts */ /* MEMO: Get animation-parts for value's each digit. */ /* MEMO: It is desirable that Animation's information are gotten after initialization of animation. */ for (int i = 0; i < (int)Constant.DIGIT_MAX; i++) { /* MEMO: Be careful. When part's name is not found, "-1" is assigned. */ TableIDPartsDigit[i] = ScriptRoot.IDGetParts(TableNameParts[i]); } /* Get Characters' Cell Index */ /* MEMO: Get cell index of bitmap font. */ Library_SpriteStudio6.Data.CellMap cellMap = ScriptRoot.CellMapGet(0); /* Since only 1 texture, specifying direct-value. (Cut corners ...) */ for (int i = 0; i < (int)KindCharacter.TERMINATOR; i++) { TableIndexCell[i] = cellMap.IndexGetCell(TableNameCell[i]); } /* Initialize Complete */ FlagInitialized = true; }
private InformationCellCharacter[,] CellInformationGet() { int countFont = (int)Constant.FONT_MAX; int countCharacter = (int)KindCharacter.TERMINATOR; InformationCellCharacter[,] table = new InformationCellCharacter[countFont, countCharacter]; if(null == table) { return(null); } /* MEMO: The CellMap name is the same as SSCE name in SpriteStudio6 project. */ /* Since there is only 1 SSCE in sample, 0 is always returned. */ int indexCellMap = ScriptRoot.IndexGetCellMap("BitmapFontNumeric_Complex"); if(0 > indexCellMap) { /* Not found */ table = null; return(null); } Library_SpriteStudio6.Data.CellMap cellMap = ScriptRoot.CellMapGet(indexCellMap); if(null == cellMap) { /* Invalid index */ table = null; return(null); } int indexCell; for(int i=0; i<countFont; i++) { for(int j=0; j<countCharacter; j++) { table[i, j].CleanUp(); /* MEMO: The cell's index stored in CellMap can be gotten from CellMap. */ indexCell = cellMap.IndexGetCell(TableNameCell[i][j]); if((0 <= indexCell) || (cellMap.CountGetCell() > indexCell)) { /* Valid Cell-index */ table[i, j].IndexCell = indexCell; /* MEMO: Cell's Information in CellMap can be get with TableCell[cell's index]. */ /* Do not change the contents of TableCell without reason. */ /* Excepting deep-copied or built-from-scratch, will overwrite master-data */ /* of ScriptableObject(Script_SpriteStudio6_DataCellMap) which stores CellMaps. */ table[i, j].SizeCell.x = cellMap.TableCell[indexCell].Rectangle.width; table[i, j].SizeCell.y = cellMap.TableCell[indexCell].Rectangle.height; } } } return(table); }
/* ********************************************************* */ //! Shallow-Copy CellMap /*! * @param cellMap * original CellMap * @retval Return-Value * New CellMap * * Creates deep-copy of specified CellMap.<br> */ public static Library_SpriteStudio6.Data.CellMap MapCopyDeep(Library_SpriteStudio6.Data.CellMap cellMap) { return(Library_SpriteStudio6.Utility.Cell.MapCopyDeep(cellMap)); }