Esempio n. 1
0
        /// <summary>
        /// Called periodically on editing Characters
        /// </summary>
        void UpdateCallback(WorldObject obj)
        {
            // make sure, Character is still in place
            var chr = (Character)obj;

            if (obj.Map != Map || !obj.IsInWorld)
            {
                Leave(chr);
                return;
            }

            // update target
            var info      = MapEditorMgr.GetOrCreateArchitectInfo(chr);
            var chrTarget = chr.Target as EditorFigurine;
            var target    = info.CurrentTarget;

            if (target != chrTarget)
            {
                target             = chrTarget;
                info.CurrentTarget = target;
                if (target != null)
                {
                    // selected new target
                }
            }
        }
Esempio n. 2
0
        public static void StopEditing(Character chr)
        {
            EditorArchitectInfo architectInfo = MapEditorMgr.GetArchitectInfo(chr);

            if (architectInfo == null)
            {
                return;
            }
            architectInfo.Editor.Leave(chr);
        }
Esempio n. 3
0
        public static MapEditor StartEditing(Map map, Character chr = null)
        {
            MapEditor editor = MapEditorMgr.GetOrCreateEditor(map);

            if (chr != null)
            {
                editor.Join(chr);
            }
            return(editor);
        }
Esempio n. 4
0
        private void OnJoin(Character chr)
        {
            if (Team.ContainsKey(chr.EntityId.Low))
            {
                return;
            }
            EditorArchitectInfo architectInfo = MapEditorMgr.GetOrCreateArchitectInfo(chr);

            Team.Add(chr.EntityId.Low, architectInfo);
            architectInfo.Editor = this;
            chr.CallPeriodically(1000, UpdateCallback);
        }
Esempio n. 5
0
        private void OnJoin(Character chr)
        {
            if (Team.ContainsKey(chr.EntityId.Low))
            {
                return;
            }

            var architect = MapEditorMgr.GetOrCreateArchitectInfo(chr);

            Team.Add(chr.EntityId.Low, architect);
            architect.Editor = this;
            chr.CallPeriodically(CharacterUpdateDelayMillis, UpdateCallback);
        }
Esempio n. 6
0
        /// <summary>Called periodically on editing Characters</summary>
        private void UpdateCallback(WorldObject obj)
        {
            Character chr = (Character)obj;

            if (obj.Map != Map || !obj.IsInWorld)
            {
                Leave(chr);
            }
            else
            {
                EditorArchitectInfo architectInfo = MapEditorMgr.GetOrCreateArchitectInfo(chr);
                EditorFigurine      target        = chr.Target as EditorFigurine;
                if (architectInfo.CurrentTarget == target)
                {
                    return;
                }
                EditorFigurine editorFigurine = target;
                architectInfo.CurrentTarget = editorFigurine;
            }
        }