浏览代码

update

/main
siyao 4 年前
当前提交
b5b9601d
共有 10 个文件被更改,包括 157 次插入17 次删除
  1. 4
      Assets/HuaweiHms/Android/res/xml/remote_config.xml
  2. 12
      Assets/HuaweiHms/src/hms/Wrapper/remote_config/ConfigValues.cs
  3. 60
      Assets/HuaweiHmsDemo/Scripts/test/RemoteConfigTest.cs
  4. 5
      ProjectSettings/EditorBuildSettings.asset
  5. 18
      Assets/HuaweiHms/src/hms/Wrapper/base/Boolean.cs
  6. 11
      Assets/HuaweiHms/src/hms/Wrapper/base/Boolean.cs.meta
  7. 22
      Assets/HuaweiHms/src/hms/Wrapper/base/Double.cs
  8. 11
      Assets/HuaweiHms/src/hms/Wrapper/base/Double.cs.meta
  9. 20
      Assets/HuaweiHms/src/hms/Wrapper/base/Long.cs
  10. 11
      Assets/HuaweiHms/src/hms/Wrapper/base/Long.cs.meta

4
Assets/HuaweiHms/Android/res/xml/remote_config.xml


<remote-config>
<value key="test1">test1</value>
<value key="test2">true</value>
<value key="test3">123</value>
<value key="test3">111</value>
<value key="test5">test-test</value>
<value key="test5">FromXml</value>
</remote-config>

12
Assets/HuaweiHms/src/hms/Wrapper/remote_config/ConfigValues.cs


public bool containKey(string arg0) {
return Call<bool>("containKey", arg0);
}
public bool getValueAsBoolean(string arg0) {
return Call<bool>("getValueAsBoolean", arg0);
public Boolean getValueAsBoolean(string arg0) {
return Call<Boolean>("getValueAsBoolean", arg0);
public double getValueAsDouble(string arg0) {
return Call<double>("getValueAsDouble", arg0);
public Double getValueAsDouble(string arg0) {
return Call<Double>("getValueAsDouble", arg0);
public long getValueAsLong(string arg0) {
return Call<long>("getValueAsLong", arg0);
public Long getValueAsLong(string arg0) {
return Call<Long>("getValueAsLong", arg0);
}
public string getValueAsString(string arg0) {
return Call<string>("getValueAsString", arg0);

60
Assets/HuaweiHmsDemo/Scripts/test/RemoteConfigTest.cs


public override void RegisterEvent(TestEvent registerEvent)
{
registerEvent("Setting Default In-app Parameter Values", SetDefualtParame);
registerEvent("set xml Value", SetXmlValue);
registerEvent("set map Value", SetMapValue);
registerEvent("Get Cloud Settings - 5 mins", GetCloudSettingsFiveMins);
registerEvent("Get Value Source", GetAllValueWithSource);
public void SetDefualtParame()
public void SetXmlValue()
showAllValues();
}
public void SetMapValue()
{
config = AGConnectConfig.getInstance();
map.put("test3", 123);
map.put("test4", 123.456);
map.put("test5", "test-test");
map.put("test3", 222);
map.put("test4", 666.456);
map.put("test5", "fromMap");
config.fetch().addOnSuccessListener(new LocationSuccessListener((AndroidJavaObject o) =>
config.fetch().addOnSuccessListener(new HmsSuccessListener<ConfigValues>((ConfigValues configValues) =>
config.apply(configValues);
TestTip.Inst.ShowText($"configValues contains {configValues.containKey("CloudBool")}");
TestTip.Inst.ShowText($"configValues as string {configValues.getValueAsString("CloudString")}");
TestTip.Inst.ShowText($"configValues as byte first byte {configValues.getValueAsByteArray("CloudByte")[0]}");
TestTip.Inst.ShowText($"configValues as long {configValues.getValueAsLong("CloudLong").longValue()}");
TestTip.Inst.ShowText($"configValues as double {configValues.getValueAsDouble("CloudDouble").doubleValue()}");
TestTip.Inst.ShowText($"configValues as bool {configValues.getValueAsBoolean("CloudBool").booleanValue()}");
showAllValues();
}))
.addOnFailureListener(new HmsFailureListener((Exception e) =>

config = AGConnectConfig.getInstance();
ConfigValues configValues = config.loadLastFetched();
config.apply(configValues);
config.fetch().addOnSuccessListener(new LocationSuccessListener((AndroidJavaObject o) =>
config.fetch().addOnSuccessListener(new HmsSuccessListener<ConfigValues>((ConfigValues o) =>
{
TestTip.Inst.ShowText("activity success");
}))

showAllValues();
}
public void GetCloudSettingsFiveMins()
{
config = AGConnectConfig.getInstance();
config.fetch(300).addOnSuccessListener(new HmsSuccessListener<ConfigValues>((ConfigValues configValues) =>
{
config.apply(configValues);
TestTip.Inst.ShowText("activity success");
}))
.addOnFailureListener(new HmsFailureListener((Exception e) =>
{
TestTip.Inst.ShowText("activity failure " + e.toString());
}));
showAllValues();
}
public void SetDeveloperMode()
{
config = AGConnectConfig.getInstance();

foreach (var key in keyArray)
{
TestTip.Inst.ShowText($"{key}: {map.getOrDefault(key, "default")}");
}
}
private void GetAllValueWithSource()
{
config = AGConnectConfig.getInstance();
Map map = config.getMergedAll();
var keySet = map.keySet();
var keyArray = keySet.toArray();
foreach (var key in keyArray)
{
TestTip.Inst.ShowText($"{key}: {config.getSource(key)}");
}
}
}

5
ProjectSettings/EditorBuildSettings.asset


- enabled: 0
path: Assets/HuaweiHmsDemo/Scenes/HmsAdsSampleScene.unity
guid: a518e96ecc8f24c66a12be14f8900ec4
- enabled: 1
- enabled: 0
- enabled: 1
path: Assets/HuaweiHmsDemo/Scenes/HmsRemoteConfigSampleScene.unity
guid: 9a5ee55b1b9414774becf40683d28db8
m_configObjects: {}

18
Assets/HuaweiHms/src/hms/Wrapper/base/Boolean.cs


using UnityEngine;
using System.Collections.Generic;
namespace HuaweiHms
{
public class Boolean_Data : IHmsBaseClass{
public string name => "java.lang.Boolean";
}
public class Boolean :HmsClass<Boolean_Data>
{
public Boolean (bool arg0): base(arg0) { }
public Boolean (string arg0): base(arg0) { }
public Boolean (): base() { }
public bool booleanValue() {
return Call<bool>("booleanValue");
}
}
}

11
Assets/HuaweiHms/src/hms/Wrapper/base/Boolean.cs.meta


fileFormatVersion: 2
guid: 60da03e015d6549228044cdcfd0502b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Assets/HuaweiHms/src/hms/Wrapper/base/Double.cs


using UnityEngine;
using System.Collections.Generic;
namespace HuaweiHms
{
public class Double_Data : IHmsBaseClass{
public string name => "java.lang.Double";
}
public class Double :HmsClass<Double_Data>
{
public const int MAX_EXPONENT = 1023;
public const int MIN_EXPONENT = -1022;
public const int SIZE = 64;
public const int BYTES = 8;
public Double (double arg0): base(arg0) { }
public Double (string arg0): base(arg0) { }
public Double (): base() { }
public double doubleValue() {
return Call<double>("doubleValue");
}
}
}

11
Assets/HuaweiHms/src/hms/Wrapper/base/Double.cs.meta


fileFormatVersion: 2
guid: 3e1efe72df37644a3a717f562e25252c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

20
Assets/HuaweiHms/src/hms/Wrapper/base/Long.cs


using UnityEngine;
using System.Collections.Generic;
namespace HuaweiHms
{
public class Long_Data : IHmsBaseClass{
public string name => "java.lang.Long";
}
public class Long :HmsClass<Long_Data>
{
public const int SIZE = 64;
public const int BYTES = 8;
public Long (string arg0): base(arg0) { }
public Long (long arg0): base(arg0) { }
public Long (): base() { }
public long longValue() {
return Call<long>("longValue");
}
}
}

11
Assets/HuaweiHms/src/hms/Wrapper/base/Long.cs.meta


fileFormatVersion: 2
guid: 315cff457cf1b42928803b09ea44e7fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存