Example #1
0
    void SetNavigationState(Vector3 destination)
    {
        if (memState == MemberState.inactive)
        {
            return;
        }
        NavMeshPath path = new NavMeshPath();

        navState = NavigatorState.noPath;

        if (_navigator.CalculatePath(destination, path))
        {
            if (path.status == NavMeshPathStatus.PathComplete)
            {
                navState = NavigatorState.pathValid;
                return;
            }
            else
            {
                navState = NavigatorState.pathInvalid;
                float diff = transform.position.y - destination.y;
                if (Mathf.Abs(diff) > _navigator.height / 2f)
                {
                    if (diff > 0) //member is on high ground jump to gangs plane
                    {
                        navState = NavigatorState.pathJump;
                    }
                    else
                    {
                        navState = NavigatorState.pathClimb;
                    }
                }
            }
        }
    }
Example #2
0
        /// <summary>
        /// 初始化一个 MarcNavigator 类的实例。
        /// </summary>
        /// <param name="navigator">参考的 MarcNavigator 对象</param>
        public MarcNavigator(MarcNavigator navigator)
        {
            //StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(navigator)里\r\n");

            this.m_navigatorState = new NavigatorState(navigator.m_navigatorState);
            this.m_nametable      = (NameTable)navigator.NameTable;
        }
Example #3
0
		public XmlEditorNavigator(XmlEditorNavigator navigator ) 
		{
			//StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(navigator)里\r\n");

            this.m_navigatorState = new NavigatorState(navigator.m_navigatorState);
            this.m_nametable = (NameTable)navigator.NameTable;
		}
Example #4
0
 public override bool MoveTo(XPathNavigator other)
 {
     if (other is XmlEditorNavigator)
     {
         this.m_navigatorState = new NavigatorState(((XmlEditorNavigator)other).m_navigatorState);
         return(true);
     }
     return(false);
 }
Example #5
0
 bool MoveToElement(IElementDescriptor element)
 {
     if (element != null)
     {
         _state = new NavigatorState(element);
         return(true);
     }
     return(false);
 }
 public NavigatorState(NavigatorState navState)
 {
     Doc          = navState.Doc;
     Root         = navState.Root;
     Node         = navState.Node;
     Attribute    = navState.Attribute;
     ElementType  = navState.ElementType;
     ElementIndex = navState.ElementIndex;
 }
        public override bool MoveTo(XPathNavigator other)
        {
            if (other is FileSystemNavigator)
            {
                State = new NavigatorState(((FileSystemNavigator)other).State);
                return(true);
            }

            return(false);
        }
Example #8
0
        public override bool MoveTo(XPathNavigator nav)
        {
            var other = nav as ObjectNavigator;

            if (other != null)
            {
                _state = other._state.Clone();
            }
            return(false);
        }
Example #9
0
        public _CupertinoBackGestureController(
            NavigatorState navigator,
            AnimationController controller
            )
        {
            D.assert(navigator != null);
            D.assert(controller != null);

            this.navigator  = navigator;
            this.controller = controller;
            this.navigator.didStartUserGesture();
        }
Example #10
0
        void Initial(NaviItem item)
        {
            Debug.Assert(item != null, "item不能为null");

            this.m_navigatorState = new NavigatorState();
            this.m_navigatorState.CurItem = item;
            this.m_navigatorState.DocRoot = item.MarcNode.Root;
            // this.m_navigatorState.VirtualRoot = new NaviItem(item.MarcNode.Root, NaviItemType.VirtualRoot);

            this.m_nametable = new NameTable();
            this.m_nametable.Add(String.Empty);
        }
Example #11
0
 /// <summary>
 /// 移动当前位置到和指定的 XPathNavigator 对象一样的位置
 /// </summary>
 /// <param name="other">参考的 XPathNavigator 对象</param>
 /// <returns>如果移动成功,返回 true;否则返回 false。当返回 false 时,表示当前位置没有发生变动。</returns>
 public override bool MoveTo(XPathNavigator other)
 {
     ////Debug.WriteLine("MoveTo");
     ////Debug.WriteLine("*** Current " + this.m_navigatorState.Dump());
     if (other is MarcNavigator)
     {
         this.m_navigatorState = new NavigatorState(((MarcNavigator)other).m_navigatorState);
         ////Debug.WriteLine("*** Changed " + this.m_navigatorState.Dump());
         return(true);
     }
     return(false);
 }
Example #12
0
        void Initial(NaviItem item)
        {
            Debug.Assert(item != null, "item不能为null");

            this.m_navigatorState         = new NavigatorState();
            this.m_navigatorState.CurItem = item;
            this.m_navigatorState.DocRoot = item.MarcNode.Root;
            // this.m_navigatorState.VirtualRoot = new NaviItem(item.MarcNode.Root, NaviItemType.VirtualRoot);

            this.m_nametable = new NameTable();
            this.m_nametable.Add(String.Empty);
        }
        public override bool MoveToFirstChild()
        {
            var tempState = (FileSystemNavigator)Clone();

            if (MoveToChild(0))
            {
                return(true);
            }

            State = new NavigatorState(tempState.State);

            return(false);
        }
        public FileSystemNavigator(FileSystemInfo document)
        {
            nametable = new NameTable();
            nametable.Add(string.Empty);

            if (document.Exists)
            {
                State = new NavigatorState(document);
            }
            else
            {
                throw new Exception("Root node must be a directory or a file");
            }
        }
        public override bool MoveToPrevious()
        {
            var nextElement = IndexInParent - 1;
            var tempState   = (FileSystemNavigator)Clone();

            if (MoveToParent())
            {
                if (MoveToChild(nextElement))
                {
                    return(true);
                }
            }
            State = new NavigatorState(tempState.State);
            return(false);
        }
Example #16
0
		// 注,测属性及其它非element节点,观察.net
		public XmlEditorNavigator(Item item)
		{
			//StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(editor)里\r\n");

			Debug.Assert(item != null,"item不能为null");

			XmlEditor document = item.m_document;
			Debug.Assert(document != null,"document不能为null");

            this.m_navigatorState = new NavigatorState();
            this.m_navigatorState.CurItem = item;        //把当前节点设为虚根
            this.m_navigatorState.DocRoot = document.docRoot;
            this.m_navigatorState.VirtualRoot = document.VirtualRoot;

            this.m_nametable = new NameTable();
            this.m_nametable.Add(String.Empty);
		}
Example #17
0
        // 注,测属性及其它非element节点,观察.net
        public XmlEditorNavigator(Item item)
        {
            //StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(editor)里\r\n");

            Debug.Assert(item != null, "item不能为null");

            XmlEditor document = item.m_document;

            Debug.Assert(document != null, "document不能为null");

            this.m_navigatorState             = new NavigatorState();
            this.m_navigatorState.CurItem     = item;    //把当前节点设为虚根
            this.m_navigatorState.DocRoot     = document.docRoot;
            this.m_navigatorState.VirtualRoot = document.VirtualRoot;

            this.m_nametable = new NameTable();
            this.m_nametable.Add(String.Empty);
        }
Example #18
0
        /// <summary>
        /// 初始化一个 MarcNavigator 类的实例。
        /// </summary>
        /// <param name="node">出发点的 MarcNode 对象</param>
        public MarcNavigator(MarcNode node)
        {
#if NO
            //StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(editor)里\r\n");

            Debug.Assert(node != null, "item不能为null");

            this.m_navigatorState             = new NavigatorState();
            this.m_navigatorState.CurItem     = new NaviItem(node, NaviItemType.Element);
            this.m_navigatorState.DocRoot     = new NaviItem(node.Root, NaviItemType.Element);
            this.m_navigatorState.VirtualRoot = this.m_navigatorState.DocRoot;

            this.m_nametable = new NameTable();
            this.m_nametable.Add(String.Empty);
#endif
            Debug.Assert(node != null, "node不能为null");
            NaviItem item = new NaviItem(node, NaviItemType.Element);
            Initial(item);
        }
Example #19
0
		/// <summary>
		/// 初始化一个 MarcNavigator 类的实例。
		/// </summary>
		/// <param name="node">出发点的 MarcNode 对象</param>
		public MarcNavigator(MarcNode node)
		{
#if NO
			//StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(editor)里\r\n");

			Debug.Assert(node != null,"item不能为null");

            this.m_navigatorState = new NavigatorState();
            this.m_navigatorState.CurItem = new NaviItem(node, NaviItemType.Element);
            this.m_navigatorState.DocRoot = new NaviItem(node.Root, NaviItemType.Element);
            this.m_navigatorState.VirtualRoot = this.m_navigatorState.DocRoot;

            this.m_nametable = new NameTable();
            this.m_nametable.Add(String.Empty);
#endif
            Debug.Assert(node != null, "node不能为null");
            NaviItem item = new NaviItem(node, NaviItemType.Element);
            Initial(item);
		}
Example #20
0
    private void Start()
    {
        _animationController = new MemberAnimationController(this);
        _myGang         = transform.parent.GetComponentInChildren <Gang>();
        _navigator      = GetComponent <NavMeshAgent>();
        _memberRb       = GetComponent <Rigidbody>();
        _memberRenderer = GetComponentInChildren <SkinnedMeshRenderer>();

        _navigator.speed = baseSpeed;
        _memberDelta     = Vector2.zero;

        _downRayLayer = 1 << LayerMask.NameToLayer("Default");

        memState = MemberState.onNav;
        navState = NavigatorState.noPath;

        queuedAnimations = new Queue <GangAnimData>();

        ClosePhysics();
    }
    void SetState(NavigatorState state)
    {
        var animator = GetComponent <Animator>();

        switch (state)
        {
        case NavigatorState.Idle:
            animator.SetBool("walking", false);
            break;

        case NavigatorState.Walking:
            animator.SetBool("walking", true);
            break;

        case NavigatorState.Finish:
            animator.SetBool("walking", false);
            break;

        default:
            throw new System.InvalidOperationException("This must not be fired!");
        }
    }
        public FileSystemNavigator(string rootNode)
        {
            FileSystemInfo document = Directory.CreateDirectory(rootNode);

            nametable = new NameTable();
            nametable.Add(string.Empty);

            if (!document.Exists)
            {
                var tempStream = File.Open(rootNode, FileMode.OpenOrCreate);
                tempStream.Close();
                document = new FileInfo(rootNode);
            }

            if (document.Exists)
            {
                State = new NavigatorState(document);
            }
            else
            {
                throw new Exception("Root node must be a directory or a file");
            }
        }
Example #23
0
			public NavigatorState(NavigatorState NavState)
			{
				this.CurItem = NavState.CurItem;
				this.DocRoot = NavState.DocRoot;
				this.VirtualRoot = NavState.VirtualRoot;
			}
Example #24
0
		public override bool MoveTo( XPathNavigator other ) 
		{
			if (other is XmlEditorNavigator )
			{
                this.m_navigatorState = new NavigatorState(((XmlEditorNavigator)other).m_navigatorState);
				return true;
			}
			return false;
		}
Example #25
0
 /// <summary>
 /// 移动当前位置到和指定的 XPathNavigator 对象一样的位置
 /// </summary>
 /// <param name="other">参考的 XPathNavigator 对象</param>
 /// <returns>如果移动成功,返回 true;否则返回 false。当返回 false 时,表示当前位置没有发生变动。</returns>
 public override bool MoveTo(XPathNavigator other)
 {
     ////Debug.WriteLine("MoveTo");
     ////Debug.WriteLine("*** Current " + this.m_navigatorState.Dump());
     if (other is MarcNavigator)
     {
         this.m_navigatorState = new NavigatorState(((MarcNavigator)other).m_navigatorState);
         ////Debug.WriteLine("*** Changed " + this.m_navigatorState.Dump());
         return true;
     }
     return false;
 }
Example #26
0
            // 复制构造函数
			public NavigatorState(NavigatorState NavState)
			{
				this.CurItem = new NaviItem(NavState.CurItem);  // 复制。位置参数都需要复制,因为复制的对象里面的这些状态以后可能被修改
				this.DocRoot = NavState.DocRoot;    // 引用。因为都是针对的同一个文档,文档本身并不需要复制
				// this.VirtualRoot = NavState.VirtualRoot;
			}
 public FileSystemNavigator(FileSystemNavigator navigator)
 {
     State     = new NavigatorState(navigator.State);
     nametable = (NameTable)navigator.NameTable;
 }
Example #28
0
 public ObjectNavigator(IElementDescriptor element)
 {
     _state = new NavigatorState(element);
     _nameTable.Add(element.Name);
 }
Example #29
0
 public NavigatorState(NavigatorState NavState)
 {
     this.CurItem     = NavState.CurItem;
     this.DocRoot     = NavState.DocRoot;
     this.VirtualRoot = NavState.VirtualRoot;
 }
Example #30
0
 public GumboNavigator(GumboWrapper gumbo, NodeWrapper node)
 {
     _Gumbo = gumbo;
     _State = new NavigatorState(node);
 }
Example #31
0
 public GumboNavigator(GumboWrapper gumbo, AttributeWrapper attribute)
 {
     _Gumbo = gumbo;
     _State = new NavigatorState(attribute);
 }
Example #32
0
        public void SetState(NavigatorState state)
        {
            if (this.LinkLable != null && this.LinkLable != "")
            {
                object obj = this.GetObjByID(this.LinkLable);
                if (obj != null && obj is Label)
                {
                    language = CliSysMegLag.GetClientLanguage();
                    language = CliUtils.fClientLang;
                    String message = SysMsg.GetSystemMessage(language, "Srvtools", "WebNavigator", "StatesName", true);
                    string[] states = message.Split(';');
                    switch (state)
                    {
                        case NavigatorState.Editing:
                            ((Label)obj).Text = states[0];
                            break;
                        case NavigatorState.Inserting:
                            ((Label)obj).Text = states[1];
                            break;
                        case NavigatorState.Browsing:
                            ((Label)obj).Text = states[2];
                            break;
                        case NavigatorState.Changed:
                            ((Label)obj).Text = states[3];
                            break;
                        case NavigatorState.ApplySucess:
                            ((Label)obj).Text = states[4];
                            break;
                        case NavigatorState.ApplyFail:
                            ((Label)obj).Text = states[5];
                            break;
                        case NavigatorState.Aborted:
                            ((Label)obj).Text = states[6];
                            break;
                    }
                }
            }
            if (this.StatusStrip != null && this.StatusStrip != "")
            {
                object obj = this.GetObjByID(this.StatusStrip);
                if (obj != null && obj is WebStatusStrip)
                {
                    //language = CliSysMegLag.GetClientLanguage();
                    language = CliUtils.fClientLang;
                    String message = SysMsg.GetSystemMessage(language, "Srvtools", "WebNavigator", "StatesName", true);
                    string[] states = message.Split(';');
                    switch (state)
                    {
                        case NavigatorState.Editing:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[0];
                            break;
                        case NavigatorState.Inserting:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[1];
                            break;
                        case NavigatorState.Browsing:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[2];
                            break;
                        case NavigatorState.Changed:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[3];
                            break;
                        case NavigatorState.ApplySucess:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[4];
                            break;
                        case NavigatorState.ApplyFail:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[5];
                            break;
                        case NavigatorState.Aborted:
                            ((WebStatusStrip)obj).NavigatorStatusText = states[6];
                            break;
                    }
                    ((WebStatusStrip)obj).CountViewID = string.IsNullOrEmpty(this.ViewBindingObject) ? this.BindingObject : this.ViewBindingObject;
                }
            }

            this.State = state;
            object o = this.GetObjByID(this.BindingObject);
            if (o != null)
            {
                if (o is WebGridView)
                {
                    WebGridView gridView = (WebGridView)o;
                    WebGridView detailControl = DetailControl(gridView);
                    if (state == NavigatorState.Changed)
                    {
                        gridView.DataHasChanged = true;
                        if (detailControl != null)
                        {
                            detailControl.DataHasChanged = true;
                        }
                    }
                    else if (state == NavigatorState.Aborted || state == NavigatorState.ApplySucess)
                    {
                        gridView.DataHasChanged = false;
                        if (detailControl != null)
                        {
                            detailControl.DataHasChanged = false;
                        }
                    }
                }
                else if (o is WebDetailsView)
                {
                    WebDetailsView detailsView = (WebDetailsView)o;
                    WebGridView detailControl = DetailControl(detailsView);
                    if (state == NavigatorState.Changed)
                    {
                        detailsView.DataHasChanged = true;
                        if (detailControl != null)
                        {
                            detailControl.DataHasChanged = true;
                        }
                    }
                    else if (state == NavigatorState.Aborted || state == NavigatorState.ApplySucess)
                    {
                        detailsView.DataHasChanged = false;
                        if (detailControl != null)
                        {
                            detailControl.DataHasChanged = false;
                        }
                    }
                }
                else if (o is WebFormView)
                {
                    WebFormView formView = (WebFormView)o;
                    WebGridView detailControl = DetailControl(formView);
                    if (state == NavigatorState.Changed)
                    {
                        formView.DataHasChanged = true;
                        if (detailControl != null)
                        {
                            detailControl.DataHasChanged = true;
                        }
                    }
                    else if (state == NavigatorState.Aborted || state == NavigatorState.ApplySucess)
                    {
                        formView.DataHasChanged = false;
                        if (detailControl != null)
                        {
                            detailControl.DataHasChanged = false;
                        }
                    }
                }
            }
        }
        private bool moveToElementChild(int index)
        {
            var child = elementChildren().Skip(index).FirstOrDefault();
            if (child == null) return false;

            position.ChildPos = index;

            var newState = new NavigatorState(child);
            _state.Push(newState);

            return true;
        }
Example #34
0
 // 复制构造函数
 public NavigatorState(NavigatorState NavState)
 {
     this.CurItem = new NaviItem(NavState.CurItem);      // 复制。位置参数都需要复制,因为复制的对象里面的这些状态以后可能被修改
     this.DocRoot = NavState.DocRoot;                    // 引用。因为都是针对的同一个文档,文档本身并不需要复制
     // this.VirtualRoot = NavState.VirtualRoot;
 }