void CreatKeyList(ref KeySettingItem[] _array, int _count, KeyCategory _keycate) { if (_array == null) { KeyCategoryItem cateitem = Instantiate(mCategoryPrefab) as KeyCategoryItem; cateitem.transform.parent = mKeysSetGrid.transform; cateitem.transform.localScale = Vector3.one; cateitem.transform.localPosition = Vector3.zero; cateitem.transform.localRotation = Quaternion.identity; cateitem.mStringID = (int)_keycate; _array = new KeySettingItem[_count]; for (int i = 0; i < _count; i++) { KeySettingItem addItem = Instantiate(mPerfab) as KeySettingItem; addItem.transform.parent = mKeysSetGrid.transform; addItem.transform.localScale = Vector3.one; addItem.transform.localPosition = Vector3.zero; addItem.transform.localRotation = Quaternion.identity; addItem.gameObject.name = "KeySetting" + i; switch (_keycate) { case KeyCategory.Common: addItem._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[0][i]); addItem._keySettingName = PeInput.StrIdOfGeneral(i); break; case KeyCategory.Character: addItem._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[1][i]); addItem._keySettingName = PeInput.StrIdOfChrCtrl(i); break; case KeyCategory.Construct: addItem._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[2][i]); addItem._keySettingName = PeInput.StrIdOfBuildMd(i); break; case KeyCategory.Carrier: addItem._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[3][i]); addItem._keySettingName = PeInput.StrIdOfVehicle(i); break; } _array[i] = addItem; } } else { for (int i = 0; i < _count; i++) { switch (_keycate) { case KeyCategory.Common: _array[i]._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[0][i]); _array[i]._keySettingName = PeInput.StrIdOfGeneral(i); break; case KeyCategory.Character: _array[i]._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[1][i]); _array[i]._keySettingName = PeInput.StrIdOfChrCtrl(i); break; case KeyCategory.Construct: _array[i]._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[2][i]); _array[i]._keySettingName = PeInput.StrIdOfBuildMd(i); break; case KeyCategory.Carrier: _array[i]._keySetting = new PeInput.KeyJoySettingPair(PeInput.SettingsAll[3][i]); _array[i]._keySettingName = PeInput.StrIdOfVehicle(i); break; } } } }