Esempio n. 1
0
        /// <summary>
        /// Merges a graph of entities with the data store.
        /// </summary>
        /// <typeparam name="T">The type of the root entity</typeparam>
        /// <param name="context">The database context to attach / detach.</param>
        /// <param name="entity">The root entity.</param>
        /// <param name="mapping">The mapping configuration to define the bounds of the graph</param>
        /// <returns>The attached entity graph</returns>
        public static T UpdateGraph <T>(this DbContext context, T entity, Expression <Func <IUpdateConfiguration <T>, object> > mapping = null) where T : class, new()
        {
            var root        = mapping == null ? new GraphNode() : new ConfigurationVisitor <T>().GetNodes(mapping);
            var graphDiffer = new GraphDiffer <T>(root);

            return(graphDiffer.Merge(context, entity));
        }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;
        if (time < 3)
        {
            return;
        }

        if (state == State.RESULT)
        {
            state = State.END;
            SceneManager.LoadScene("ResultScene");
        }

        if (messages.Length == index && state == State.PLAY)
        {
            time  = 0;
            state = State.RESULT;
            GameObject obj = Instantiate(endingResultObject, transform);
            obj.GetComponentInChildren <Text>().text = endingResultText;
            return;
        }

        bool isClick = Input.GetMouseButtonDown(0);

        if (!isClick && index != 0)
        {
            return;
        }

        if (!messageText.IsViewed())
        {
            messageText.SetAllViewed();
            return;
        }

        messageText.SetMessage(messages[index]);
        if (gameObjects[index] != null)
        {
            if (gameObjects[index] == backGroundObjects)
            {
                backGroundObjects.GetComponent <Animator>().SetBool("tv_off", true);
            }
            else
            {
                GameObject obj = Instantiate(gameObjects[index], GameObject.Find("BackGroundObjects").transform);
                if (obj.GetComponent <GraphDiffer>() != null)
                {
                    graphDiffer = obj.GetComponent <GraphDiffer>();
                }
            }
        }
        if (graphDiffs[index] != "")
        {
            graphDiffer.SetSprite(graphDiffs[index]);
        }

        index++;
    }
Esempio n. 3
0
        // other methods are convenience wrappers around this.
        private static T UpdateGraph <T>(this DbContext context, T entity, T persisted, Expression <Func <IUpdateConfiguration <T>, object> > mapping,
                                         string mappingScheme, UpdateParams updateParams) where T : class
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            var entityManager = new EntityManager(context);
            var queryLoader   = new QueryLoader(context, entityManager);
            var register      = new AggregateRegister(new CacheProvider());

            var root   = GetRootNode(mapping, mappingScheme, register);
            var differ = new GraphDiffer <T>(context, queryLoader, entityManager, root);

            var queryMode = updateParams != null ? updateParams.QueryMode : QueryMode.SingleQuery;

            return(differ.Merge(entity, persisted, queryMode));
        }