virtual public void OnObjectPropertyChange(string strPropName) { if (mDataObject == null) { return; } switch (strPropName) { case "Name": { string name = ""; mDataObject.QueryPropStringW(strPropName, ref name); mObjName = name; } break; case "Level": mDataObject.QueryPropInt(strPropName, ref mLevel); break; default: break; } }
public static void CallAddObject(string strIdent) { try { Game game = Game.Instance; if (game == null || game.mGameClient == null) { return; } IGameSceneObj sceneObj = game.mGameClient.GetSceneObj(strIdent); if (sceneObj == null) { return; } IObject cObj = null; int type = 0; if (!sceneObj.QueryPropInt("ObjectType", ref type)) { LogSystem.Log("could not find type : ", strIdent); return; } string strModel = string.Empty; if (!sceneObj.QueryPropString("ResourcePath", ref strModel)) { LogSystem.Log("could not find ResourcePath : ", strIdent); return; } ObjectType ObjType = (ObjectType)type; switch (ObjType) { case ObjectType.ObjectType_Player: if (game.mGameClient.IsPlayer(strIdent)) { cObj = new CRoleObject(); ObjectManager.mRole = cObj as CRoleObject; } else { cObj = new CPlayerObject(); } break; case ObjectType.ObjectType_Npc: cObj = new CNpcObject(); break; case ObjectType.ObjectType_Monster: cObj = new CMonsterObject(); break; case ObjectType.ObjectType_Soldier: case ObjectType.ObjectType_Creeps: break; case ObjectType.ObjectType_Born: break; } if (cObj != null) { cObj.mObjectType = ObjType; cObj.mGameSceneObj = sceneObj; cObj.mObjectRes = strModel; cObj.mStrIdent = strIdent; cObj.OnAddObject(); ObjectManager.AddObject(strIdent, cObj); if (cObj is CRoleObject) { //GUIManager.CacheView<CharacterPanel>(); //GUIManager.CacheView<PlayerMainViewPanel>(); //GUIManager.CacheView<PlayerControlPanel>(); //GUIManager.CacheView<PlayerStatePanel>(); //GUIManager.CacheView<PlayerMapControlPanel>(); //GUIManager.CacheView<MainChatPanel>(); // 添加到主角的AOI中 } else { RangeTools.MotifyObjectAoi(mRole, cObj); } } } catch (System.Exception ex) { LogSystem.LogError("on_add_object catch error", ex.ToString()); } }