/// <summary> /// 初始化桌子上的涂卡 /// </summary> void GetTukaObject() { if (GTB == null) { GameObject gtb = ResManager.GetPrefab("Prefabs/Objects/TY_GTB"); gtb.name = "TY_GTB"; gtb.transform.SetParent(transform); gtb.transform.localPosition = new Vector3(-2.67f, 0.5672f, -0.406f); GTB = gtb.AddComponent <AnimationOper>(); } //Reinforcement rfc = EnhanceCommunityModel.GetInstance().CurReinforcement; //rfc = new Reinforcement(new PropsData("chips", 2, PropsType.reinforcement, "薯片"));//测试代码 Reinforcement rfc = GlobalDataManager.GetInstance().CurReinforcement; EnhanceCommunityModel.GetInstance().CurReinforcement = rfc; if (rfc != null) { Debug.Log("GetTukaObject"); int objId = rfc.pData.id; qhw = ObjectsManager.instanse.GetQHW(); qhw.transform.SetParent(transform); string qhwName = ((PropsTag)objId).ToString(); qhw.name = qhwName; QHWCtrl qhwCtrl = qhw.GetComponent <QHWCtrl>(); qhwCtrl.ShowObj(qhwName); string _tuka = "tuka_" + ((PropsTag)objId).ToString(); Material matSource = EnhanceCommunityModel.GetInstance().GetTuKa(_tuka).GetComponent <MeshRenderer>().materials[1]; //图卡材质 deskTuka = ObjectsManager.instanse.GetdeskTuka(); //桌面图卡 deskTuka.transform.SetParent(transform); deskTuka.name = _tuka; TukaCtrl tukaCtrl = deskTuka.GetComponent <TukaCtrl>(); xhTk = tukaCtrl.ShowObj("XH_GTB_TUKA"); Material matTar = xhTk.GetComponent <MeshRenderer>().materials[1]; matTar.CopyPropertiesFromMaterial(matSource); xhTk.gameObject.SetActive(false); lsTk = tukaCtrl.GetObj("LS_JZS_TUKA"); matTar = lsTk.GetComponent <MeshRenderer>().materials[1]; matTar.CopyPropertiesFromMaterial(matSource); Invoke("XhTakeCard", 1); } else { Tip(); } }
/// <summary> /// 初始化桌子上的涂卡 /// </summary> void GetTukaObject() { Reinforcement rfc = SwapModel.GetInstance().CurReinforcement; //rfc = new Reinforcement(new PropsData("chips", 2, PropsType.reinforcement, "薯片"));//测试代码 if (rfc != null) { Debug.Log("GetTukaObject"); int objId = rfc.pData.id; qhw = ObjectsManager.instanse.GetQHW(); qhw.transform.SetParent(transform); string qhwName = ((PropsTag)objId).ToString(); qhw.name = qhwName; QHWCtrl qhwCtrl = qhw.GetComponent <QHWCtrl>(); qhwCtrl.ShowObj(qhwName); string _tuka = "tuka_" + ((PropsTag)objId).ToString(); Material matSource = SwapModel.GetInstance().GetTuKa(_tuka).GetComponent <MeshRenderer>().materials[1]; //图卡材质 GameObject deskTuka = ObjectsManager.instanse.GetdeskTuka(); //桌面图卡 deskTuka.transform.SetParent(transform); deskTuka.name = _tuka; TukaCtrl tukaCtrl = deskTuka.GetComponent <TukaCtrl>(); xhTk = tukaCtrl.ShowObj("XH_ZS_TUKA"); Material matTar = xhTk.GetComponent <MeshRenderer>().materials[1]; matTar.CopyPropertiesFromMaterial(matSource); lsTk = tukaCtrl.GetObj("LS_JZS_TUKA"); matTar = lsTk.GetComponent <MeshRenderer>().materials[1]; matTar.CopyPropertiesFromMaterial(matSource); Invoke("XhTakeCard", 1); } else { Tip(); } }