示例#1
0
        public static GameProjectLoadResult LoadProject(GameProjectData objectData)
        {
            GameProjectLoadResult result;

            if (objectData == null || objectData.ObjectData == null)
            {
                result = null;
            }
            else
            {
                GameProjectLoadResult          gameProjectLoadResult = new GameProjectLoadResult();
                Dictionary <int, VisualObject> dictionary            = new Dictionary <int, VisualObject>();
                CSCocosHelp.RefreshLayoutSystemState(false);
                BaseRecorder.IsCreateDefaultRecorder     = false;
                gameProjectLoadResult.RootObject         = GameProjectLoader.ConvertObject(objectData.ObjectData, gameProjectLoadResult, dictionary);
                gameProjectLoadResult.RootObject.CanEdit = true;
                CSCocosHelp.RefreshLayoutSystemState(true);
                BaseRecorder.IsCreateDefaultRecorder = true;
                GameProjectLoader.RefreshObjectsRecorder(gameProjectLoadResult.RootObject);
                if (objectData.Animation != null)
                {
                    gameProjectLoadResult.TimelineAction = GameProjectLoader.ConvertTimeLineAction(objectData.Animation, gameProjectLoadResult.RootObject, dictionary);
                }
                result = gameProjectLoadResult;
            }
            return(result);
        }
        private static HashSet <ResourceData> SearchResourceItemData(GameProjectData projectData)
        {
            HashSet <ResourceData> hashSet  = new HashSet <ResourceData>();
            HashSet <ResourceData> hashSet2 = GameProjectContent.ScanObjectData(projectData.ObjectData);

            if (hashSet2 != null)
            {
                hashSet.UnionWith(hashSet2);
            }
            hashSet2 = GameProjectContent.ScanAnimationData(projectData.Animation);
            if (hashSet2 != null)
            {
                hashSet.UnionWith(hashSet2);
            }
            return(hashSet);
        }
        private static HashSet <ResourceData> SearchResourceItemData(GameProjectData projectData)
        {
            HashSet <ResourceData> resourceDataSet1 = new HashSet <ResourceData>();
            HashSet <ResourceData> resourceDataSet2 = GameProjectContent.ScanObjectData(projectData.ObjectData);

            if (resourceDataSet2 != null)
            {
                resourceDataSet1.UnionWith((IEnumerable <ResourceData>)resourceDataSet2);
            }
            HashSet <ResourceData> resourceDataSet3 = GameProjectContent.ScanAnimationData(projectData.Animation);

            if (resourceDataSet3 != null)
            {
                resourceDataSet1.UnionWith((IEnumerable <ResourceData>)resourceDataSet3);
            }
            return(resourceDataSet1);
        }
示例#4
0
        public static GameProjectData SaveProject(NodeObject vObject, TimelineAction action)
        {
            GameProjectData result;

            if (vObject == null)
            {
                result = null;
            }
            else
            {
                NodeObjectData     objectData         = GameProjectLoader.ConvertObjectData(vObject);
                TimelineActionData timelineActionData = new TimelineActionData();
                timelineActionData.Duration = action.Duration;
                timelineActionData.Speed    = action.Speed;
                GameProjectLoader.ConvertTimeLineActionData(vObject, timelineActionData);
                result = new GameProjectData
                {
                    ObjectData = objectData,
                    Animation  = timelineActionData
                };
            }
            return(result);
        }