public void Init() { var configPath = SystemPreset.GetConfigPath <HeroCfg>(); var heroCfgs = ResourceSys.Instance.LoadAll <HeroCfg>(configPath); for (var i = 0; i < heroCfgs.Length; i++) { heroCfgs[i].BuildDerivedData(); } mHeroCfgs.AddRange(heroCfgs); mHeroCfgs.Sort((a, b) => { if (a.mId < b.mId) { return(-1); } if (a.mId > b.mId) { return(1); } return(0); }); mIdToHeroCfg = ConfigToolkit.ListToDictionary(heroCfgs, (v) => v.mId); }
public SkillConfigMgr() { var skillCfgs = ResourceSys.Instance.LoadAll <SkillCfg>(SystemPreset.GetConfigPath <SkillCfg>()); foreach (var skillCfg in skillCfgs) { skillCfg.OnCreate(); mIdToSkillCfg.Add(skillCfg.mId, skillCfg); } }
void Update() { if (Input.GetMouseButtonDown(1)) { var ray = mMainCamera.Value.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (SystemPreset.IsGround(hit.transform.gameObject.tag)) { MsgSys.Send(GameEvent.ClickEnvGround, hit.point); } } } }