void OnActorCreate(GFX.GfxActor actor)
 {
     if (actor != null && actor.getGameObject() != null)
     {
         mGoToActorMap.Add(actor.getGameObject(), actor);
         setActiveActor(actor);
     }
 }
Exemple #2
0
 public void OnRenderInterfaceCreatedEvt(GFX.GfxActor actor)
 {
     //建立RenderInterface GameObject和 该Object之间的映射,用于射线查询 [1/4/2012 ZZY]
     if (mRenderInterface != null && mRenderInterface.getGameObject() != null)
     {
         CObjectManager.Instance.insertPhyObject(mRenderInterface.getGameObject(), this);
     }
 }
Exemple #3
0
 void OnActorCreate(GFX.GfxActor actor)
 {
     if (actor != null && actor.getGameObject() != null)
     {
         mActorPhyMap.Add(actor.getGameObject(), actor);
         NotifyActiveActor(actor);
     }
 }
Exemple #4
0
 void destroyActor()
 {
     if (mObject != null)
     {
         GFX.GFXObjectManager.Instance.DestroyObject(mObject);
         mObject = null;
     }
 }
    public void addGrowPoint(int id, Vector3 pos)
    {
        _DBC_LIFEABILITY_GROWPOINT growPoint = mGrowPointDBC.Search_Index_EQU(id);

        GFX.GfxActor actor = (GFX.GfxActor)GFX.GFXObjectManager.Instance.createObject(growPoint.szMeshFile, GFX.GFXObjectType.ACTOR);
        actor.position = pos;
        mAllGrowPoint.Add(actor, id);
        actor.setRenderInterfaceCreateEvt(new GFX.OnRenderInterfaceEvent(OnActorCreate));
    }
Exemple #6
0
    public void saveToFile(string path)
    {
        StreamWriter sw         = new StreamWriter(path);
        int          actorCount = mAllActor.Count;

        sw.WriteLine("[info]");//ini头
        sw.WriteLine("monstercount=" + actorCount.ToString());
        int i = 0;

        foreach (KeyValuePair <GFX.GfxActor, CMonsterInstanceInfo> kv in mAllActor)
        {
            GFX.GfxActor actor = kv.Key;
            if (actor == null || actor.getGameObject() == null)
            {
                continue;
            }
            CMonsterInstanceInfo monsterInfo = kv.Value;
            sw.WriteLine("");
            sw.WriteLine("[monster" + i.ToString() + "]");//section
            sw.WriteLine("guid=" + monsterInfo.m_dwMonsterGUID.ToString());
            sw.WriteLine("type=" + monsterInfo.m_dwObjectId.ToString());
            sw.WriteLine("name=" + monsterInfo.m_strInstanceName);
            sw.WriteLine("title=" + monsterInfo.m_strTitleName);
            sw.WriteLine("pos_x=" + actor.getGameObject().transform.position.x.ToString());
            //sw.WriteLine("pos_y=" + actor.position.y.ToString());
            sw.WriteLine("pos_z=" + actor.getGameObject().transform.position.z.ToString());
            //float dir =  GFX.GfxUtility.GetYAngle(Vector3.zero, actor.getGameObject().transform.forward)*180.0f/3.14f;
            float dir  = (actor.getGameObject().transform.rotation.eulerAngles.y / 180.0f) * 3.14f;
            int   iDir = (int)((dir / (6.28f)) * 36);
            iDir = iDir + 27;
            iDir = iDir % 36;
            sw.WriteLine("dir=" + iDir.ToString());
            sw.WriteLine("script_id=" + monsterInfo.m_EvenId.ToString());
            sw.WriteLine("respawn_time=" + monsterInfo.m_iRefreshTime.ToString());
            sw.WriteLine("group_id=" + monsterInfo.m_iGroupId);
            sw.WriteLine("team_id=" + monsterInfo.m_iTeamId);
            sw.WriteLine("base_ai=" + monsterInfo.m_iBaseAIId);
            sw.WriteLine("ai_file=" + monsterInfo.m_iAdvanceAIId);
            sw.WriteLine("patrol_id=" + monsterInfo.m_iLineid);
            sw.WriteLine("shop0=" + monsterInfo.m_iShopArray[0]);
            sw.WriteLine("shop1=" + monsterInfo.m_iShopArray[1]);
            sw.WriteLine("shop2=" + monsterInfo.m_iShopArray[2]);
            sw.WriteLine("shop3=" + monsterInfo.m_iShopArray[3]);
            sw.WriteLine("ReputationID=" + monsterInfo.m_iReputationID);
            sw.WriteLine("level=" + monsterInfo.m_iLevel);
            sw.WriteLine("npc=" + monsterInfo.m_iType);
            sw.WriteLine("camp=" + monsterInfo.m_iCampId);
            i++;
        }
        sw.Close();
    }
 void setActiveActor(GFX.GfxActor actor)
 {
     if (mActiveActor != null)
     {
         mActiveActor.SetMouseHover(false);
     }
     //UnityEditor.Selection.activeGameObject = GameObject.Find("SGEditor");
     mActiveActor = actor;
     if (mActiveActor != null)
     {
         mActiveActor.SetMouseHover(true);
         if (mAllGrowPoint.ContainsKey(mActiveActor))
         {
             int id = mAllGrowPoint[mActiveActor];
             mCurrentIndex = mIDToIndex[id];
         }
     }
     mGUIDirty = true;
 }
Exemple #8
0
    void CreateGameObject()
    {
        destroyActor();
        mObject = (GFX.GfxActor)GFX.GFXObjectManager.Instance.createObject(AllActors[actorIndex], GFX.GFXObjectType.ACTOR);

        //换装
        mObject.changePart(0, BodyEquips[BodyEquipIndex] != "none" ? BodyEquips[BodyEquipIndex]:"");
        mObject.setBodyEffect(AllEffects[BodyEffectIndex] != "none"?AllEffects[BodyEffectIndex]:"");
        mObject.changePart(1, HairEquips[HairEquipIndex] != "none" ? HairEquips[HairEquipIndex]:"");
        mObject.changePart(2, FaceEquips[FaceEquipIndex] != "none" ? FaceEquips[FaceEquipIndex]:"");
        mObject.changePart(3, ShoulderEquips[ShoulderEquipIndex] != "none" ? ShoulderEquips[ShoulderEquipIndex]:"");
        mObject.setShoulderEffect(AllEffects[ShoulderEffectIndex] != "none"?AllEffects[ShoulderEffectIndex]:"");
        mObject.changeRightWeapon(AllWeapons[rightWeaponIndex] != "none"?AllWeapons[rightWeaponIndex]:"");
        mObject.changeLeftWeapon(AllWeapons[leftWeaponIndex] != "none"?AllWeapons[leftWeaponIndex]:"");
        mObject.SetRightWeaponEffect(AllEffects[rightWeaponEffectIndex] != "none"?AllEffects[rightWeaponEffectIndex]:"");
        mObject.SetLeftWeaponEffect(AllEffects[leftWeaponEffectIndex] != "none"?AllEffects[leftWeaponEffectIndex]:"");

        isReadyUpdateLocater = true;
    }
Exemple #9
0
    void NotifyActiveActor(GFX.GfxActor actor)
    {
        // UnityEditor.Selection.activeGameObject = GameObject.Find("SGEditor");
        CMonsterInstanceInfo MonsterInfo = mAllActor[actor];

        CMonsterInstanceInfo.Copy(MonsterInfo, mCurrentMonsterInfo);
        if (mCurrentActor != null)
        {
            mCurrentActor.SetMouseHover(false);
        }
        mCurrentActor = actor;
        // UnityEditor.Selection.activeGameObject = actor.getGameObject();
        if (mCurrentActor != null)
        {
            mCurrentActor.SetMouseHover(true);
        }
        mCurrentSelectMonsterIndex = mCurrentMonsterInfo.m_popupIndex;
        mInspectorDirty            = true;
    }
Exemple #10
0
    public void AddActor(int ID, CMonsterInstanceInfo theMonsterInfo, Vector3 pos, Quaternion rot)
    {
        _DBC_CREATURE_ATT monsterAttr = mMonsterTable.Search_Index_EQU(ID);

        if (monsterAttr == null)
        {
            return;
        }
        _DBC_CHARACTER_MODEL CharModel = CDataBaseSystem.Instance.GetDataBase <_DBC_CHARACTER_MODEL>((int)DataBaseStruct.DBC_CHARACTER_MODEL).Search_Index_EQU(monsterAttr.nModelID);

        if (CharModel == null)
        {
            return;
        }
        GFX.GfxActor actor = (GFX.GfxActor)GFX.GFXObjectManager.Instance.createObject(CharModel.m_pszModelName, GFX.GFXObjectType.ACTOR);
        actor.position = pos;
        actor.rotation = rot;
        actor.setRenderInterfaceCreateEvt(new GFX.OnRenderInterfaceEvent(OnActorCreate));
        CMonsterInstanceInfo monsterInfo = new CMonsterInstanceInfo();

        CMonsterInstanceInfo.Copy(theMonsterInfo, monsterInfo);
        mAllActor.Add(actor, monsterInfo);
    }
    // Update is called once per frame
    void Update()
    {
        bool leftButtonDown  = Input.GetMouseButtonDown(0);
        bool rightButtonDown = Input.GetMouseButtonDown(1);

        if (rightButtonDown || leftButtonDown)//鼠标左键或右键按下
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;
            bool       hit = Physics.Raycast(ray, out hitInfo);
            if (!hit)
            {
                return;
            }
            Vector3 hitPos = hitInfo.point;

            if (rightButtonDown)//摆放模式
            {
                addGrowPoint(mIndexToID[mCurrentIndex], hitPos);
            }
            if (leftButtonDown)//选择模式
            {
                if (hitInfo.collider != null && mGoToActorMap.ContainsKey(hitInfo.collider.gameObject))
                {
                    GFX.GfxActor actor = mGoToActorMap[hitInfo.collider.gameObject];
                    setActiveActor(actor);
                }
            }
        }
        //处理删除
        if (Input.GetKeyDown(KeyCode.Delete))
        {
            deleteCurrent();
        }
        GFX.GfxSystem.Instance.Tick();
    }
Exemple #12
0
    void OnGUI()
    {
        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Object");
        actorIndex = EditorGUILayout.Popup(actorIndex, AllActors.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Body");
        BodyEquipIndex = EditorGUILayout.Popup(BodyEquipIndex, BodyEquips.ToArray());
        GUILayout.Label("Effect");
        BodyEffectIndex = EditorGUILayout.Popup(BodyEffectIndex, AllEffects.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Hair");
        HairEquipIndex = EditorGUILayout.Popup(HairEquipIndex, HairEquips.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Face");
        FaceEquipIndex = EditorGUILayout.Popup(FaceEquipIndex, FaceEquips.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Shoulder");
        ShoulderEquipIndex = EditorGUILayout.Popup(ShoulderEquipIndex, ShoulderEquips.ToArray());
        GUILayout.Label("Effect");
        ShoulderEffectIndex = EditorGUILayout.Popup(ShoulderEffectIndex, AllEffects.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Right Weapon");
        rightWeaponIndex = EditorGUILayout.Popup(rightWeaponIndex, AllWeapons.ToArray());
        GUILayout.Label("Effect");
        rightWeaponEffectIndex = EditorGUILayout.Popup(rightWeaponEffectIndex, AllEffects.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Left Weapon");
        leftWeaponIndex = EditorGUILayout.Popup(leftWeaponIndex, AllWeapons.ToArray());
        GUILayout.Label("Effect");
        leftWeaponEffectIndex = EditorGUILayout.Popup(leftWeaponEffectIndex, AllEffects.ToArray());
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Animation");
        int oldAnimIndex = AnimNameIndex;

        AnimNameIndex = EditorGUILayout.Popup(AnimNameIndex, AnimNames.ToArray());
        if (oldAnimIndex != AnimNameIndex && AnimNameIndex >= 0 && AnimNameIndex < AnimNames.Count && mObject != null)
        {
            mObject.EnterSkill(true, AnimNames[AnimNameIndex] != "none"?AnimNames[AnimNameIndex]:"", true, 0.3f);
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Reset"))
        {
            reset();
        }
        GUILayout.BeginHorizontal("box");
        if (GUILayout.Button("OK"))
        {
            if (!EditorApplication.isPlaying)
            {
                EditorApplication.isPlaying = true;
            }
            else
            {
                if (AllActors[actorIndex] != "none")
                {
                    CreateGameObject();
                    LocatorNames.Clear();
                    LocatorNames.Add("none");
                }
                else
                {
                    if (mObject != null)
                    {
                        GFX.GFXObjectManager.Instance.DestroyObject(mObject);
                        mObject = null;
                    }
                }
            }
        }
//      if(GUILayout.Button("stop"))
//      {
//          destroyActor();
//             AssetBundleManager.AssetBundleRequestManager.clearAssetBundles();
//          if (EditorApplication.isPlaying) EditorApplication.isPlaying = false;
//      }
        GUILayout.EndHorizontal();
        DisplaySkillGUI();
    }
 public void create(string actorName)
 {
     mObject = (GFX.GfxActor)GFX.GFXObjectManager.Instance.createObject(actorName, GFX.GFXObjectType.ACTOR);
 }