private void LoadTextureFromSystem(Pvr_ControllerVisual visual, string controllerName) { string texFormat = (string)curControllerData["tex_format"]; var texturepath = modelFilePath + controllerName + "_idle." + texFormat; visual.m_idle = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_app." + texFormat; visual.m_app = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_home." + texFormat; visual.m_home = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_touch." + texFormat; visual.m_touchpad = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_volume_down." + texFormat; visual.m_volDn = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_volume_up." + texFormat; visual.m_volUp = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_trigger." + texFormat; visual.m_trigger = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_a." + texFormat; visual.m_a = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_b." + texFormat; visual.m_b = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_x." + texFormat; visual.m_x = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_y." + texFormat; visual.m_y = LoadOneTexture(texturepath); texturepath = modelFilePath + controllerName + "_grip." + texFormat; visual.m_grip = LoadOneTexture(texturepath); }
private void LoadTextureFromSystem(Pvr_ControllerVisual visual) { var texturepath = modelFilePath + "controller" + controllerType + "s_idle.png"; visual.m_idle = LoadOneTexture(texturepath); texturepath = modelFilePath + "controller" + controllerType + "s_app.png"; visual.m_app = LoadOneTexture(texturepath); texturepath = modelFilePath + "controller" + controllerType + "s_home.png"; visual.m_home = LoadOneTexture(texturepath); texturepath = modelFilePath + "controller" + controllerType + "s_touchpad.png"; visual.m_touchpad = LoadOneTexture(texturepath); texturepath = modelFilePath + "controller" + controllerType + "s_volumedown.png"; visual.m_volDn = LoadOneTexture(texturepath); texturepath = modelFilePath + "controller" + controllerType + "s_volumeup.png"; visual.m_volUp = LoadOneTexture(texturepath); if (Controller.UPvr_IsEnbleTrigger()) { texturepath = modelFilePath + "controller" + controllerType + "s_trigger.png"; visual.m_trigger = LoadOneTexture(texturepath); } }
private void LoadTexture(Pvr_ControllerVisual visual, string controllerName, bool fromRes) { if (fromRes) { texFormat = ""; prePath = controllerName; } else { texFormat = "." + (string)curControllerData["tex_format"]; prePath = modelFilePath + controllerName; } var texturepath = prePath + "_idle" + texFormat; visual.m_idle = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_app" + texFormat; visual.m_app = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_home" + texFormat; visual.m_home = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_touch" + texFormat; visual.m_touchpad = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_volume_down" + texFormat; visual.m_volDn = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_volume_up" + texFormat; visual.m_volUp = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_trigger" + texFormat; visual.m_trigger = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_a" + texFormat; visual.m_a = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_b" + texFormat; visual.m_b = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_x" + texFormat; visual.m_x = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_y" + texFormat; visual.m_y = LoadOneTexture(texturepath, fromRes); texturepath = prePath + "_grip" + texFormat; visual.m_grip = LoadOneTexture(texturepath, fromRes); }
private void LoadControllerFromSystem(int id) { var syscontrollername = controllerType.ToString() + id.ToString() + ".obj"; var fullFilePath = modelFilePath + syscontrollername; if (!File.Exists(fullFilePath)) { PLOG.I("PvrLog Obj File does not exist==" + fullFilePath); } else { GameObject go = new GameObject(); go.name = modelName; MeshFilter meshFilter = go.AddComponent <MeshFilter>(); meshFilter.mesh = Pvr_ObjImporter.Instance.ImportFile(fullFilePath); go.transform.SetParent(transform); go.transform.localPosition = Vector3.zero; MeshRenderer meshRenderer = go.AddComponent <MeshRenderer>(); int matID = (int)curControllerData["material_type"]; meshRenderer.material = matID == 0 ? standardMat : unlitMat; loadModelSuccess = true; Pvr_ControllerVisual controllerVisual = go.AddComponent <Pvr_ControllerVisual>(); switch (controllerType) { case 1: { controllerVisual.currentDevice = ControllerDevice.Goblin; } break; case 2: { controllerVisual.currentDevice = ControllerDevice.Neo; } break; case 3: { controllerVisual.currentDevice = ControllerDevice.G2; } break; case 4: { controllerVisual.currentDevice = ControllerDevice.Neo2; } break; default: controllerVisual.currentDevice = ControllerDevice.NewController; break; } controllerVisual.variety = Variety; LoadTexture(controllerVisual, controllerType.ToString() + id.ToString(), false); go.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); go.transform.localScale = new Vector3(-0.01f, 0.01f, 0.01f); } }
private void LoadControllerFromSystem() { var syscontrollername = "controller" + controllerType + "s.obj"; var fullFilePath = modelFilePath + "/" + syscontrollername; if (!File.Exists(fullFilePath)) { Debug.Log("Obj File does not exist"); } else { GameObject go = new GameObject(); go.name = "controller" + controllerType + "s"; MeshFilter meshFilter = go.AddComponent <MeshFilter>(); meshFilter.mesh = Pvr_ObjImporter.Instance.ImportFile(fullFilePath); go.transform.SetParent(transform); go.transform.localPosition = Vector3.zero; MeshRenderer meshRenderer = go.AddComponent <MeshRenderer>(); meshRenderer.material = generalMat; loadModelSuccess = true; Pvr_ControllerVisual controllerVisual = go.AddComponent <Pvr_ControllerVisual>(); switch (controllerType) { case 1: { controllerVisual.currentDevice = ControllerDevice.Goblin1; } break; case 2: { controllerVisual.currentDevice = ControllerDevice.Neo; } break; case 3: { controllerVisual.currentDevice = ControllerDevice.Goblin2; } break; default: controllerVisual.currentDevice = ControllerDevice.NewController; break; } controllerVisual.variety = Variety; LoadTextureFromSystem(controllerVisual); if (controllerType <= 3) { var touch = Instantiate(pptouch); touch.transform.SetParent(go.transform); touch.GetComponent <Pvr_TouchVisual>().currentDevice = controllerVisual.currentDevice; touch.GetComponent <Pvr_TouchVisual>().variety = Variety; switch (controllerType) { case 2: { var power = Instantiate(controllerpower); power.transform.SetParent(go.transform); power.transform.localPosition = new Vector3(0, 1.07f, 3.73f); } break; case 3: { var power = Instantiate(controllerpower); power.transform.SetParent(go.transform); power.transform.localPosition = new Vector3(0, 1.576f, 3.73f); var tips = Instantiate(controllertips); tips.transform.SetParent(go.transform); tips.transform.localPosition = new Vector3(-0.143f, 0.44f, -0.87f); } break; } } go.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); go.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); } }