Esempio n. 1
0
        public CCNode ReadNodeGraphFromFile(string fileName, object owner, CCSize parentSize)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            string strCCBFileName = fileName;
            string strSuffix      = ".ccbi";

            // Add ccbi suffix
            if (!CCBReader.EndsWith(strCCBFileName, strSuffix))
            {
                strCCBFileName += strSuffix;
            }

            string strPath = CCFileUtils.FullPathFromRelativePath(strCCBFileName);

            var pBytes = CCFileUtils.GetFileBytes(strPath);

            byte[] data = pBytes;

            CCNode ret = ReadNodeGraphFromData(data, owner, parentSize);

            return(ret);
        }
Esempio n. 2
0
        protected virtual CCNode ParsePropTypeCcbFile(CCNode node, CCNode parent, CCBReader reader)
        {
            string ccbFileName = reader.ReadCachedString();

            /* Change path extension to .ccbi. */
            string ccbFileWithoutPathExtension = CCBReader.DeletePathExtension(ccbFileName);

            ccbFileName = ccbFileWithoutPathExtension + ".ccbi";

            // Load sub file
            string path      = CCFileUtils.FullPathFromRelativePath(ccbFileName);
            var    ccbReader = new CCBReader(reader);

            byte[] pBytes = CCFileUtils.GetFileBytes(path);
            ccbReader.InitWithData(pBytes, reader.Owner);
            ccbReader.AnimationManager.RootContainerSize = parent.ContentSize;

            CCNode ccbFileNode = ccbReader.ReadFileWithCleanUp(false);

            if (ccbFileNode != null && ccbReader.AnimationManager.AutoPlaySequenceId != -1)
            {
                // Auto play animations
                ccbReader.AnimationManager.RunAnimations(ccbReader.AnimationManager.AutoPlaySequenceId, 0);
            }

            return(ccbFileNode);
        }
Esempio n. 3
0
        public CCNode ReadNodeGraphFromFile(string fileName, object owner, CCSize parentSize, ref CCBAnimationManager animationManager)
        {
            string pPath = CCFileUtils.FullPathFromRelativePath(fileName);

            byte[] pBytes = CCFileUtils.GetFileBytes(pPath);
            CCNode ret    = ReadNodeGraphFromData(pBytes, owner, parentSize, ref animationManager);

            return(ret);
        }