Exemple #1
0
 public void ProcessByTargetChar()
 {
     if (this.m_pkChar.GetID() == 1)
     {
         NrCharUser nrCharUser = (NrCharUser)this.m_pkChar;
         if (nrCharUser.GetFollowCharPersonID() > 0L)
         {
             NrCharBase followChar = this.GetFollowChar(nrCharUser.GetFollowCharPersonID());
             if (followChar != null && followChar.GetCharObject() != null && Vector3.Distance(this.m_vFollowCharLastPos, followChar.GetCharObject().transform.position) > 60f)
             {
                 int nMapIndex = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_kCharMapInfo.m_nMapIndex;
                 this.m_vFollowCharLastPos = new Vector3(followChar.GetCharObject().transform.position.x, followChar.GetCharObject().transform.position.y, followChar.GetCharObject().transform.position.z);
                 float   d   = 6f;
                 Vector3 lhs = followChar.GetCharObject().transform.position + d * -followChar.GetCharObject().transform.forward;
                 if (lhs != Vector3.zero)
                 {
                     this.m_pkChar.m_kCharMove.AutoMoveTo(nMapIndex, (short)lhs.x, (short)lhs.z, true);
                     NrTSingleton <NkQuestManager> .Instance.SetAutoPathInfo(null);
                 }
                 return;
             }
         }
     }
     if (this.CheckTargetPositionChanged())
     {
         Vector3 charPos = this.m_pkTargetChar.GetPersonInfo().GetCharPos();
         this.MoveTo(charPos.x, charPos.y, charPos.z);
     }
 }
Exemple #2
0
    public void BothCharMove()
    {
        NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1);

        if (@char == null)
        {
            return;
        }
        NrCharUser nrCharUser = (NrCharUser)@char;

        if (nrCharUser.GetFollowCharPersonID() > 0L)
        {
            if (!(NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_STOPAUTOMOVE) is StopAutoMove))
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
            }
            return;
        }
        if (!this.bMouseCharMove)
        {
            nrCharUser.m_kCharMove.MoveStop(true, false);
            nrCharUser.m_kCharMove.SetIncreaseMove();
        }
        nrCharUser.m_kCharMove.MouseMove();
        this.bMouseCharMove = true;
    }
Exemple #3
0
    public bool AutoMoveTo(int DestMapIndex, short DestX, short DestY, bool bFollowChar)
    {
        if (this.m_pkChar == null || this.m_pkChar.GetID() != 1)
        {
            return(false);
        }
        if (!NrTSingleton <NkClientLogic> .Instance.IsMovable())
        {
            return(false);
        }
        if (!bFollowChar && this.m_pkChar != null && this.m_pkChar.IsCharKindATB(1L))
        {
            NrCharUser nrCharUser = (NrCharUser)this.m_pkChar;
            if (nrCharUser.GetFollowCharPersonID() > 0L)
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);

                return(false);
            }
        }
        DestMapIndex = NrTSingleton <MapManager> .Instance.GetAutoMoveDestMapIndex(DestMapIndex);

        if (NrTSingleton <NrAutoPath> .Instance.Generate(DestMapIndex, DestX, DestY, bFollowChar) == 0)
        {
            return(false);
        }
        Vector3 lhs = NrTSingleton <NrAutoPath> .Instance.PopMovePath();

        if (lhs != Vector3.zero)
        {
            this.MoveTo(lhs.x, lhs.y, lhs.z);
        }
        return(true);
    }
Exemple #4
0
    public int Generate(int DestMapIndex, short DestX, short DestY, bool bFollowChar)
    {
        if (!this.ReadyCharInfo())
        {
            return(0);
        }
        if (!bFollowChar && this.m_MainUser != null && this.m_MainUser.IsCharKindATB(1L))
        {
            NrCharUser nrCharUser = (NrCharUser)this.m_MainUser;
            if (nrCharUser.GetFollowCharPersonID() > 0L)
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);

                return(0);
            }
        }
        if (this.m_pkUserObj == null)
        {
            this.m_Debugstring.Add("ERROR USER NOT FOUND");
        }
        if (this.m_cGxRoadPointMgr == null)
        {
            this.m_Debugstring.Add("ERROR M_CGXROADPOINTMGR NOT FOUND");
        }
        int nMapIndex = this.m_pkCharMapInfo.m_nMapIndex;

        this.m_Debugstring.Add(string.Concat(new object[]
        {
            "AUTOPATH \n STARTMAP: ",
            nMapIndex,
            "\tDESTMAP:",
            DestMapIndex,
            " \nDEST POSX:",
            DestX,
            " POSY:",
            DestY
        }));
        NrTSingleton <NkQuestManager> .Instance.IncreaseQuestParamVal(2, 0L, 1L);

        Vector3 v3Dest = new Vector3((float)DestX, 0f, (float)DestY);

        this.m_v3Dest      = v3Dest;
        this.m_iDestMapIdx = DestMapIndex;
        if (nMapIndex == DestMapIndex)
        {
            this.CurrentMapMove(DestX, DestY);
        }
        else
        {
            this.NextMapMove(nMapIndex, this.DestMapIdx);
        }
        this.ClearUserData();
        if (this.MovePathCount() > 0)
        {
            return(1);
        }
        return(0);
    }
Exemple #5
0
 public void MoveToFollowChar()
 {
     if (this.m_pkChar.GetID() == 1)
     {
         NrCharUser nrCharUser = (NrCharUser)this.m_pkChar;
         if (nrCharUser.GetFollowCharPersonID() > 0L)
         {
             NrCharBase followChar = this.GetFollowChar(nrCharUser.GetFollowCharPersonID());
             if (followChar != null && followChar.GetCharObject() != null)
             {
                 float num  = 5f;
                 float num2 = Vector3.Distance(this.m_vCharPos, followChar.GetCharObject().transform.position);
                 if (num2 > num)
                 {
                     int nMapIndex = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_kCharMapInfo.m_nMapIndex;
                     this.m_vFollowCharLastPos = new Vector3(followChar.GetCharObject().transform.position.x, followChar.GetCharObject().transform.position.y, followChar.GetCharObject().transform.position.z);
                     float   d   = num + 1f;
                     Vector3 lhs = followChar.GetCharObject().transform.position + d * -followChar.GetCharObject().transform.forward;
                     if (lhs != Vector3.zero)
                     {
                         this.m_pkChar.m_kCharMove.AutoMoveTo(nMapIndex, (short)lhs.x, (short)lhs.z, true);
                         NrTSingleton <NkQuestManager> .Instance.SetAutoPathInfo(null);
                     }
                     return;
                 }
                 float num3 = this.CheckDistance(this.m_vLastCharPos, this.m_vCharPos);
                 float num4 = 1f;
                 if (num3 >= num4)
                 {
                     this.SendCharMovePacketForKeyBoardMove(true);
                 }
             }
             else
             {
                 nrCharUser.RefreshFollowCharPos();
             }
         }
     }
 }
Exemple #6
0
    private void CharKeyBoardMove()
    {
        if ((int)this.CurCharKeyMoveStatus == 0 && (int)this.PrevCharKeyMoveStatus == 0)
        {
            return;
        }
        NrTSingleton <NkClientLogic> .Instance.InitPickChar();

        sbyte prevCharKeyMoveStatus = this.PrevCharKeyMoveStatus;

        this.PrevCharKeyMoveStatus = this.CurCharKeyMoveStatus;
        NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

        if (nrCharUser == null)
        {
            return;
        }
        if (!nrCharUser.IsReadyCharAction())
        {
            return;
        }
        if (nrCharUser.GetFollowCharPersonID() > 0L)
        {
            if (!(NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_STOPAUTOMOVE) is StopAutoMove))
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
            }
            this.CurCharKeyMoveStatus  = 0;
            this.PrevCharKeyMoveStatus = 0;
            return;
        }
        if ((int)this.CurCharKeyMoveStatus == 0)
        {
            if ((int)prevCharKeyMoveStatus > 0)
            {
                nrCharUser.m_kCharMove.MoveStop(true, true);
                nrCharUser.m_kCharMove.SendCharMovePacketForKeyBoardMove(true);
            }
            return;
        }
        if ((int)prevCharKeyMoveStatus == 0)
        {
            nrCharUser.m_kCharMove.MoveStop(false, false);
            nrCharUser.m_kCharMove.SetIncreaseMove();
        }
        nrCharUser.m_kCharMove.KeyboardMove();
        NrTSingleton <CRightClickMenu> .Instance.CloseUI(CRightClickMenu.CLOSEOPTION.CLICK);
    }
Exemple #7
0
 public bool SceneChange()
 {
     try
     {
         if (!this.ReadyCharInfo())
         {
             this.m_Debugstring.Add("AUTO MOVE MAP PATH CNT: ReadyCharInfo() == false)");
             bool result = false;
             return(result);
         }
         if (this.m_MainUser.IsCharKindATB(1L) && Scene.PreScene != Scene.Type.BATTLE)
         {
             NrCharUser nrCharUser = (NrCharUser)this.m_MainUser;
             if (nrCharUser.GetFollowCharPersonID() > 0L)
             {
                 nrCharUser.RefreshFollowCharPos();
                 bool result = true;
                 return(result);
             }
         }
         if (this.m_MapPath == null)
         {
             this.m_Debugstring.Add("m_MapPath is null");
             bool result = true;
             return(result);
         }
         if (this.m_bAutoMove && this.m_MapPath.Count > 0 && !this.m_MainUser.m_kCharMove.AutoMoveTo(this.m_iDestMapIdx, (short)this.m_v3Dest.x, (short)this.m_v3Dest.z))
         {
             this.ResetData();
         }
     }
     catch (Exception ex)
     {
         this.m_Debugstring.Add("AutoPath " + ex.Message);
     }
     this.ClearUserData();
     return(true);
 }
Exemple #8
0
    public Vector3 FindFirstPath(int DestMapIndex, short DestX, short DestY, bool bFollowChar)
    {
        Vector3 zero = Vector3.zero;

        if (this.m_pkChar == null || this.m_pkChar.GetID() != 1)
        {
            return(zero);
        }
        if (!NrTSingleton <NkClientLogic> .Instance.IsMovable())
        {
            return(zero);
        }
        if (!bFollowChar && this.m_pkChar != null && this.m_pkChar.IsCharKindATB(1L))
        {
            NrCharUser nrCharUser = (NrCharUser)this.m_pkChar;
            if (nrCharUser.GetFollowCharPersonID() > 0L)
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);

                return(zero);
            }
        }
        DestMapIndex = NrTSingleton <MapManager> .Instance.GetAutoMoveDestMapIndex(DestMapIndex);

        if (NrTSingleton <NrAutoPath> .Instance.Generate(DestMapIndex, DestX, DestY, bFollowChar) == 0)
        {
            return(zero);
        }
        if (NrTSingleton <NrAutoPath> .Instance.MovePathCount() >= 2)
        {
            NrTSingleton <NrAutoPath> .Instance.PopMovePath();

            return(NrTSingleton <NrAutoPath> .Instance.PopMovePath());
        }
        return(NrTSingleton <NrAutoPath> .Instance.PopMovePath());
    }
Exemple #9
0
    public void MyCharMoveMouse()
    {
        NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1);

        if (@char == null)
        {
            return;
        }
        if (NkInputManager.GetMouseButton(0) && NkInputManager.GetMouseButton(1))
        {
            NrCharUser nrCharUser = (NrCharUser)@char;
            if (nrCharUser.GetFollowCharPersonID() > 0L)
            {
                if (!(NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_STOPAUTOMOVE) is StopAutoMove))
                {
                    NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
                }
                return;
            }
            if (!this.bMouseCharMove)
            {
                nrCharUser.m_kCharMove.MoveStop(true, false);
                nrCharUser.m_kCharMove.SetIncreaseMove();
            }
            nrCharUser.m_kCharMove.MouseMove();
            this.bMouseCharMove = true;
        }
        else if (NkInputManager.GetMouseButtonUp(0))
        {
            if (this.bMouseCharMove)
            {
                if (@char != null)
                {
                    @char.m_kCharMove.MoveStop(true, true);
                    @char.m_kCharMove.SendCharMovePacketForKeyBoardMove(true);
                }
                this.bMouseCharMove = false;
                this.SetSafeClickTime(-0.2f);
                return;
            }
            this.UpdateWalkEffect(false);
            if (NrTSingleton <FormsManager> .Instance.IsMouseOverForm())
            {
                return;
            }
            if (!NrTSingleton <NkClientLogic> .Instance.IsPickingEnable())
            {
                NrTSingleton <NkClientLogic> .Instance.SetPickingEnable(true);

                return;
            }
            if (!NrTSingleton <NkClientLogic> .Instance.IsMovable())
            {
                return;
            }
            if (this.fSafeClickTime > 0f && Time.time - this.fSafeClickTime < 0.5f)
            {
                return;
            }
            NrCharUser nrCharUser2 = (NrCharUser)@char;
            if (nrCharUser2.GetFollowCharPersonID() > 0L)
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
            }
            else
            {
                NrCharBase pickChar = NrTSingleton <NkClientLogic> .Instance.GetPickChar();

                if (pickChar != null)
                {
                    if (NrTSingleton <NkClientLogic> .Instance.GetFocusChar() == null)
                    {
                        pickChar.CancelClickMe();
                        nrCharUser2.m_kCharMove.SetTargetChar(null);
                    }
                    else
                    {
                        pickChar.SetClickMe();
                        if (!pickChar.IsCharKindATB(32L))
                        {
                            nrCharUser2.m_kCharMove.SetTargetChar(pickChar);
                        }
                        else
                        {
                            nrCharUser2.m_kCharMove.SetTargetChar(null);
                        }
                    }
                }
                else
                {
                    NrCharBase targetChar = nrCharUser2.m_kCharMove.GetTargetChar();
                    if (targetChar != null)
                    {
                        targetChar.CancelClickMe();
                    }
                    nrCharUser2.m_kCharMove.SetTargetChar(null);
                }
                nrCharUser2.PickingMove();
            }
            Dlg_Collect dlg_Collect = (Dlg_Collect)NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_COLLECT);

            if (dlg_Collect != null)
            {
                dlg_Collect.OnClose();
            }
            this.fSafeClickTime = 0f;
        }
        else if (this.bMouseCharMove)
        {
            if (@char != null)
            {
                @char.m_kCharMove.MoveStop(true, true);
                @char.m_kCharMove.SendCharMovePacketForKeyBoardMove(true);
            }
            this.bMouseCharMove = false;
            this.SetSafeClickTime(-0.2f);
        }
    }
Exemple #10
0
    public void TabCharMove()
    {
        if (!NrTSingleton <NkQuestManager> .Instance.IsCompletedFirstQuest())
        {
            return;
        }
        NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

        if (nrCharUser != null)
        {
            if (!NrTSingleton <NkClientLogic> .Instance.IsMovable())
            {
                nrCharUser.m_kCharMove.MoveStop(true, true);
                return;
            }
            if (this.bMouseCharMove)
            {
                nrCharUser.m_kCharMove.MoveStop(true, true);
                nrCharUser.m_kCharMove.SendCharMovePacketForKeyBoardMove(true);
                this.bMouseCharMove = false;
                this.SetSafeClickTime(-0.2f);
                return;
            }
        }
        this.UpdateWalkEffect(false);
        if (!NrTSingleton <NkClientLogic> .Instance.IsPickingEnable())
        {
            NrTSingleton <NkClientLogic> .Instance.SetPickingEnable(true);

            return;
        }
        if (!NrTSingleton <NkClientLogic> .Instance.IsMovable())
        {
            return;
        }
        if (this.fSafeClickTime > 0f && Time.time - this.fSafeClickTime < 0.5f)
        {
            return;
        }
        NrCharUser nrCharUser2 = nrCharUser;

        if (nrCharUser == null)
        {
            return;
        }
        if (nrCharUser2.GetFollowCharPersonID() > 0L)
        {
            NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
        }
        else
        {
            if (Launcher.Instance.LocalPatchLevel != Launcher.Instance.PatchLevelMax && NrTSingleton <NrAutoPath> .Instance.IsAutoMoving())
            {
                string textFromMessageBox = NrTSingleton <NrTextMgr> .Instance.GetTextFromMessageBox("168");

                string textFromMessageBox2 = NrTSingleton <NrTextMgr> .Instance.GetTextFromMessageBox("240");

                MsgBoxUI msgBoxUI = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MSGBOX_DLG) as MsgBoxUI;

                msgBoxUI.SetMsg(new YesDelegate(this.OnAutoMoveStop), null, textFromMessageBox, textFromMessageBox2, eMsgType.MB_OK_CANCEL, 2);
                msgBoxUI.SetButtonOKText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("320"));
                msgBoxUI.SetButtonCancelText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("321"));
                return;
            }
            NrCharBase pickChar = NrTSingleton <NkClientLogic> .Instance.GetPickChar();

            if (pickChar != null)
            {
                if (NrTSingleton <NkClientLogic> .Instance.GetFocusChar() == null)
                {
                    pickChar.CancelClickMe();
                    nrCharUser2.m_kCharMove.SetTargetChar(null);
                }
                else
                {
                    pickChar.SetClickMe();
                    if (!pickChar.IsCharKindATB(32L))
                    {
                        nrCharUser2.m_kCharMove.SetTargetChar(pickChar);
                    }
                    else
                    {
                        nrCharUser2.m_kCharMove.SetTargetChar(null);
                    }
                }
            }
            else
            {
                NrCharBase targetChar = nrCharUser2.m_kCharMove.GetTargetChar();
                if (targetChar != null)
                {
                    targetChar.CancelClickMe();
                }
                nrCharUser2.m_kCharMove.SetTargetChar(null);
            }
            nrCharUser2.PickingMove();
        }
        Dlg_Collect dlg_Collect = (Dlg_Collect)NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_COLLECT);

        if (dlg_Collect != null)
        {
            dlg_Collect.OnClose();
        }
        this.fSafeClickTime = 0f;
    }