// 穿装备 public void AddEquip(int instanceid){ if (instanceid == -1) return; bool isequip = UserDataManager.instance.AddEquip(role.GetData().instanceid, instanceid); //role.GetData().weaponid = instanceid; if (!isequip) return; EquipData edata = UserDataManager.instance.GetEquip(instanceid); role.AddEquip(edata); role.ResetAllProperty(); }
public override void Init() { base.Init(); EventManager.Register(this, EventID.EVENT_GAME_TOUCH_GROUND, EventID.EVENT_GAME_TOUCH_OBJ, EventID.EVENT_UI_EQUIP, EventID.EVENT_UI_DELEQUIP, EventID.EVENT_UI_UNEQUIP, EventID.EVENT_DATA_REFRESHPROPERTY); RoleData rd = UserDataManager.instance.GetChooseRoleData(); role = InGameManager.GetInstance().inGameObjManager.AddObj(rd.roldid,enMSCamp.en_camp_player) as InGameBaseCharacter; role.SetData(rd); //InGameManager.GetInstance().GetManager<InGameObjManager>(InGameManager.enGameManager.InGameObjManager).AddObj(0); Vector3 startpos = InGameManager.GetInstance().inGameLevelManager.gameMap.GetStartPosition(); role.transform.position = GameCommon.GetWorldPos(startpos); role.SetZPos(); InGameManager.GetInstance().inGameCameraManager.SetTarget(role.gameObject); for (int i = 0; i < rd.choseEquipList.Count; i++) { if (rd.choseEquipList[i] == -1) continue; EquipData edata = UserDataManager.instance.GetEquip(rd.choseEquipList[i]); role.AddEquip(edata); } //UserDataManager.instance.AddLevelupPoint(role.GetData().instanceid,5); role.ResetAllProperty(true); EventData.CreateEvent(EventID.EVENT_GAME_INITROLE).AddData(role).Send(); }