public void OnCreateCharacter(object sender, CreateCharacterEventArgs e) { if (MyCreateCharacter != null) { MyCreateCharacter(sender, e); } }
/// <summary> /// 类型:方法 /// 名称:OnCreate /// 作者:taixihuase /// 作用:触发创建角色事件 /// 编写日期:2015/7/29 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnCreate(object sender, CreateCharacterEventArgs e) { CreateCharacterButton.gameObject.SetActive(true); FindObjectOfType<LoadCharacter>().EnterGameButton.gameObject.SetActive(false); PhotonService.Events.OnCreateCharacter(sender, e); }
/// <summary> /// 类型:方法 /// 名称:OnCreate /// 作者:taixihuase /// 作用:当创建角色事件触发时,创建角色数据并发送给服务端 /// 编写日期:2015/7/29 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateCharacterData(object sender, CreateCharacterEventArgs e) { PhotonService.Player.SetCharacterOriginal(new Character(e.User)); }
/// <summary> /// 类型:方法 /// 名称:CreateCharacter /// 作者:taixihuase /// 作用:当成功获取到角色数据时触发创建角色事件 /// 编写日期:2015/7/29 /// </summary> /// <param name="sender"></param> /// <param name="user"></param> /// <returns></returns> private IEnumerator CreateCharacter(object sender, UserInfo user) { CreateCharacter create; while ((create = FindObjectOfType<CreateCharacter>()) == null) { yield return null; } CreateCharacterEventArgs cc = new CreateCharacterEventArgs(user); create.OnCreate(sender, cc); Destroy(transform.parent.gameObject); }