Exemple #1
0
 public void MakeChar()
 {
     if (this.m_CenterChar == null || this._MakeCharCodes == null)
     {
         UnityEngine.Object.Destroy(base.gameObject);
         return;
     }
     this.MakeComplete = false;
     base.enabled      = true;
     if (this.m_MakeNpcTable == null)
     {
         this.m_MakeNpcTable = new Dictionary <string, SubNpc>();
     }
     for (int i = 0; i < this._MakeCharCodes.Count; i++)
     {
         float y    = this.m_CenterChar.m_k3DChar.GetRootGameObject().transform.localEulerAngles.y;
         float num  = 0f;
         int   num2 = this._PositionList[i];
         if (num2 == -1)
         {
             num = y + this.degreeTemp[this._GetEmptySlot()];
         }
         else if (0 <= num2 && 5 > num2)
         {
             num = y + this.degreeTemp[num2];
         }
         float f     = num * 0.0174532924f;
         POS3D pOS3D = new POS3D();
         pOS3D.x = this.m_CenterChar.GetPersonInfo().GetCharPos().x + 15f * Mathf.Sin(f);
         pOS3D.y = 0f;
         pOS3D.z = this.m_CenterChar.GetPersonInfo().GetCharPos().z + 15f * Mathf.Cos(f);
         float f2     = (num + 180f) * 0.0174532924f;
         POS3D pOS3D2 = new POS3D();
         pOS3D2.x = 1f * Mathf.Sin(f2);
         pOS3D2.y = 0f;
         pOS3D2.z = 1f * Mathf.Cos(f2);
         NrCharBase nrCharBase = this._CreateClientNPC(this._MakeCharCodes[i], pOS3D, pOS3D2);
         if (nrCharBase != null)
         {
             SubNpc subNpc = new SubNpc();
             subNpc.i32ID         = nrCharBase.GetID();
             subNpc.CharCode      = nrCharBase.GetCharKindInfo().GetCode();
             subNpc.i16CharUnique = nrCharBase.GetCharUnique();
             if (!this.m_MakeNpcTable.ContainsKey(nrCharBase.GetCharKindInfo().GetCode()))
             {
                 this.m_MakeNpcTable.Add(nrCharBase.GetCharKindInfo().GetCode(), subNpc);
             }
         }
     }
 }
Exemple #2
0
    public bool SetMakeChar(NrCharBase CenterChar, string[] CharCodes, MakeSubNPC.LoadComplete CompleteFunc)
    {
        bool flag = false;

        if (this._MakeCharCodes == null)
        {
            this._MakeCharCodes = new List <string>();
        }
        this.m_CenterChar = CenterChar;
        this._MakeCharCodes.Clear();
        this._PositionList.Clear();
        for (int i = 0; i < CharCodes.Length; i++)
        {
            string text = CharCodes[i];
            if (!(text == string.Empty))
            {
                if (!(text == "event"))
                {
                    if (this.m_MakeNpcTable != null && this.m_MakeNpcTable.ContainsKey(text))
                    {
                        SubNpc subNpc = this.m_MakeNpcTable[text];
                        if (subNpc != null)
                        {
                            subNpc.bDel = false;
                        }
                    }
                    else if (!text.Equals(this.m_CenterChar.GetCharKindInfo().GetCode()))
                    {
                        this._MakeCharCodes.Add(text);
                        this._PositionList.Add(-1);
                        flag = true;
                    }
                }
            }
        }
        if (this.m_MakeNpcTable != null)
        {
            this.DelChar();
            foreach (SubNpc current in this.m_MakeNpcTable.Values)
            {
                current.bDel = true;
            }
        }
        if (flag)
        {
            this._CompleteFunc = CompleteFunc;
        }
        return(flag);
    }