public static void UpdateNMConfigurationPlist(string path) { string fileName = "NMGSDKCoreKit.framework/Resources/NMConfiguration.plist"; string pListPath = Path.Combine(path, fileName); Dictionary <string, object> pList = (Dictionary <string, object>)Plist.readPlist(pListPath); pList ["zone"] = CoreKitSetting.getInstance().Zone; pList ["gameCode"] = CoreKitSetting.getInstance().GameCode; pList ["useLog"] = CoreKitSetting.getInstance().UseLog; pList ["httpTimeOutSec"] = CoreKitSetting.getInstance().HttpTimeOutSec; pList ["useFacebookLoginViewInApp"] = CoreKitSetting.getInstance().UseFBLoginInApp; pList ["useFixedPlayerID"] = CoreKitSetting.getInstance().UseFixedPlayerId; // pList ["OTPLength"] = NMConfigSetting.Instance.OtpLength; // pList ["OTPLifeCycle"] = NMConfigSetting.Instance.OtpLifeCycle; // pList ["OTPHistoryPeriod"] = NMConfigSetting.Instance.OtpHistoryPeriod; Plist.writeXml(pList, pListPath); }
private static CoreKitSetting GetCoreKitSetting() { if (null != Resources.Load("CoreKit")) { if (null != Resources.Load("NMGPlayModeCoreKit")) { AssetDatabase.DeleteAsset("Assets/NetmarbleS/NMGPlayMode/Resources/NMGPlayModeCoreKit.asset"); } return(CoreKitSetting.getInstance()); } if (null != Resources.Load("NMGPlayModeCoreKit")) { System.Type settingType = System.Type.GetType("NetmarbleS.NMGPlugin.Setting"); if (null != settingType) { AssetDatabase.DeleteAsset("Assets/NetmarbleS/NMGPlayMode/Resources/NMGPlayModeCoreKit.asset"); return(CoreKitSetting.getInstance()); } else { CoreKitSetting playModeCoreKit = Resources.Load("NMGPlayModeCoreKit") as CoreKitSetting; System.Type playmodetype = playModeCoreKit.GetType(); System.Reflection.FieldInfo info = playmodetype.GetField("instance", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); info.SetValue(playModeCoreKit, playModeCoreKit); return(playModeCoreKit); } } CoreKitSetting setting = ScriptableObject.CreateInstance <CoreKitSetting>(); AssetDatabase.CreateAsset(setting, "Assets/NetmarbleS/NMGPlayMode/Resources/NMGPlayModeCoreKit.asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); System.Type type = setting.GetType(); System.Reflection.FieldInfo fieldInfo = type.GetField("instance", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); fieldInfo.SetValue(setting, setting); return(setting); }
public override void OnInspectorGUI() { Setting instance = target as Setting; instance.IsUse = EditorGUILayout.Popup(instance.IsUse, options); if (instance.IsUse == 0) { if (null != instance.kits) { if (null == editorList) { editorList = new Dictionary <string, Editor>(); foreach (KeyValuePair <string, ScriptableObject> kit in instance.kits) { editorList.Add(kit.Key, Editor.CreateEditor(kit.Value)); } } foreach (KeyValuePair <string, Editor> editor in editorList) { EditorGUILayout.LabelField("[" + editor.Key + "]"); editor.Value.OnInspectorGUI(); DrawSeperator(); } if (GUILayout.Button("Apply Android Configuration")) { CoreKitSetting core = instance.kits["CoreKit"] as CoreKitSetting; NMGXmlGenerator xml = new NMGXmlGenerator(PlayerSettings.bundleIdentifier, core); foreach (KeyValuePair <string, ScriptableObject> kit in instance.kits) { System.Type type = kit.Value.GetType(); System.Reflection.FieldInfo fieldInfo = type.GetField("replaceDic", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); if (null != fieldInfo) { Dictionary <string, string> replaceDic = (Dictionary <string, string>)type.GetMethod("GetReplaceDic").Invoke(kit.Value, null); xml.AddReplaceDic(replaceDic); } } xml.GenerateManifest(); xml.GenerateNMConfigurationXml(); xml.GenerateNMPluginXml(instance.pluginAndroid); Dictionary <string, object> dic = new Dictionary <string, object>(); foreach (KeyValuePair <string, ScriptableObject> kit in instance.kits) { Plugin plugin = kit.Value as Plugin; Dictionary <string, object> strings = plugin.GetStrings(); if (null != strings) { foreach (KeyValuePair <string, object> value in strings) { if (!dic.ContainsKey(value.Key)) { dic.Add(value.Key, value.Value); } } } } xml.GenerateStringsXml(dic); } } } }