/// <summary> /// 获取当前预览的物体,更新预览界面的角色灯光 /// </summary> public void UpdatePreviewLight(GameObject preview_object) { var role_ids = GameConstHelper.GetUintList("GAME_AVAILABLE_ROLE_ID"); var type_ids = new List <uint>(role_ids.Count); foreach (var rid in role_ids) { type_ids.Add(ActorHelper.RoleIdToTypeId(rid)); } uint actor_type_id = 0; var client_model = preview_object.GetComponentInChildren <ActorMono>(true); if (client_model != null && client_model.BindActor != null) { actor_type_id = client_model.BindActor.TypeIdx; } if (type_ids.Contains(actor_type_id)) { PreviewLight.SelectLight(0, ActorHelper.TypeIdToRoleId(actor_type_id)); } else { PreviewLight.SelectLight(0, 0); } }
public void SelectActor(int actor_index) { if (!IsShow) { return; } for (int i = 0; i < mActorGameObjects.Count; ++i) { Actor actor = mActorGameObjects [i]; if (actor != null) { actor.mVisibleCtrl.SetActorVisible(i == actor_index, VisiblePriority.EXCEPT); } } if (actor_index >= 0 && actor_index < mActorGameObjects.Count) { Actor selectObj = mActorGameObjects [actor_index]; if (selectObj != null)// 在切场景时,有可能选中的角色已经被销毁 { if (SelectActorScene.Instance != null) { SelectActorScene.Instance.PreviewObject = selectObj.GetModelParent(); } PreviewLight.SelectLight(1, mData[actor_index].rid); } } if (actor_index < mData.Count) { string name = System.Text.Encoding.UTF8.GetString(mData[actor_index].name); mPowerText.text = xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_93") + ActorHelper.GetDisplayBattlePower(mData[actor_index].battle_power); } }
private bool SelectActor(int index) { if (index >= mRoleData.Count) { return(false); } mSelectIndex = index; if (mActors.Count > index) { mActors[index].transform.localRotation = Quaternion.identity; } PlayRandomActorAudio(index); PlayDebutAnimation(); ChangeActorVisble(); PreviewLight.SelectLight(1, (uint)(index + 1)); return(true); }
/// <summary> /// 点击角色职业的按钮 /// </summary> /// <param name="vocation"></param> void OnClickActorBtn(uint vocation) { // 设置当前的CheckMask var cur_select_btn = mActorButtons[vocation].transform; cur_select_btn.Find("CheckMask").gameObject.SetActive(true); cur_select_btn.Find("Background").gameObject.SetActive(false); if (mVocationId == vocation) { return; } // 设置之前的CheckMask if (mVocationId != 0) { var last_select_btn = mActorButtons[mVocationId].transform; last_select_btn.Find("CheckMask").gameObject.SetActive(false); last_select_btn.Find("Background").gameObject.SetActive(true); } if (CreateActorScene.Instance && CreateActorScene.Instance.SelectActorByVocation(vocation, () => { if (IsShow == true) { mRightButtom.SetActive(true); mRight.SetActive(true); } })) { if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) { for (int i = 0; i < mActorPic.Count; i++) { if (mActorPic[i] != null) { RawImage image = mActorPic[i].GetComponent <RawImage>(); if (image != null && image.texture != null) { mActorPic[i].gameObject.SetActive(i + 1 == vocation); } } } } mVocationId = vocation; RequestRoleName(); PreviewLight.SelectLight(1, mVocationId); RefreshDescription(); if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) { return; } mRightButtom.SetActive(false); mRight.SetActive(false); if (AuditManager.Instance.AuditAndIOS() == false) { mRightButtom.SetActive(true); mRight.SetActive(true); } } }