活动暂存
This commit is contained in:
1 parent
e231d3540e
commit
1148e29379
30 files changed
+3478
-29
No files matched your search
@@ -0,0 +1,48 @@
|
||||
using Assets.Scripts;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivityAdController : PFUIPanel
|
||||
{
|
||||
protected override void Awake()
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("LightUpChina/Btn").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Close();
|
||||
//可以传参
|
||||
//UIManager.ShowActivityPanel(url);
|
||||
ConfigHelper.activityApi.JoinActivity(2);
|
||||
if (string.IsNullOrEmpty(App.CurrentUser.Contact) || string.IsNullOrEmpty(App.CurrentUser.ContactPhone) || string.IsNullOrEmpty(App.CurrentUser.ContactAddress))
|
||||
{
|
||||
UIManager.ShowAddressPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowActivityPanel(url);
|
||||
}
|
||||
|
||||
});
|
||||
//UIManager.AddEvent(transform.Find("LightUpChina/BtnRule").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
//{
|
||||
// Application.OpenURL("https://www.baidu.com/");
|
||||
//});
|
||||
|
||||
}
|
||||
string image = null, url = null;
|
||||
public void Initial(string image, string url)
|
||||
{
|
||||
this.image = image;
|
||||
App.ActivityUrl = url;
|
||||
this.url = url;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b1e8b738244e0c479ad2a05dd24d3e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,36 +1,40 @@
|
||||
using System.Collections;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ActivityController : PFUIPanel
|
||||
{
|
||||
Transform browser;
|
||||
UniWebView webView;
|
||||
protected override void Awake()
|
||||
{
|
||||
browser = transform.Find("Browser");
|
||||
UIManager.AddEvent(browser.Find("Image").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
CloseFunc();
|
||||
});
|
||||
var rect = browser.GetComponent<RectTransform>();
|
||||
webView = browser.GetComponent<UniWebView>();
|
||||
webView.Frame = new Rect(0, 0, Screen.width, Screen.height);
|
||||
webView.ReferenceRectTransform = rect;
|
||||
webView.BackgroundColor = Utils.HexToColorHtml("#23232d");
|
||||
//webView.LoadHTMLString("<div style='width:100%;height:100%;background:#000;'></div>", "http://192.168.0.101:3081");
|
||||
//webView.Show();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
Debug.Log(20);
|
||||
Invoke("StartPageFunc",1.0f);
|
||||
//Debug.Log(20);
|
||||
//Invoke("StartPageFunc",0.5f);
|
||||
}
|
||||
|
||||
private void StartPageFunc()
|
||||
{
|
||||
Debug.Log("开始");
|
||||
var rect = browser.GetComponent<RectTransform>();
|
||||
var webView = browser.GetComponent<UniWebView>();
|
||||
webView.Frame = new Rect(0, 0, Screen.width, Screen.height);
|
||||
|
||||
webView.ReferenceRectTransform = rect;
|
||||
// Load a URL.
|
||||
webView.Load("http://192.168.0.101:3081/Activity/LightUpChina");
|
||||
webView.Load(url);
|
||||
// Show it.
|
||||
webView.Show();
|
||||
webView.OnMessageReceived -= FromJs;
|
||||
@@ -41,6 +45,8 @@ public class ActivityController : PFUIPanel
|
||||
switch (message.Path)
|
||||
{
|
||||
case "Close": CloseFunc(); break;
|
||||
case "StartRide": StartRide(message.Args); break;
|
||||
case "Share": Share(message.Args); break;
|
||||
default:break;
|
||||
}
|
||||
//if (message.Path.Equals("Close"))
|
||||
@@ -49,6 +55,39 @@ public class ActivityController : PFUIPanel
|
||||
// //transform.Find("Text").GetComponent<Text>().text = message.Args["msg"];
|
||||
//}
|
||||
}
|
||||
|
||||
private void Share(Dictionary<string, string> args)
|
||||
{
|
||||
int type = int.Parse(args["type"]);
|
||||
int id = int.Parse(args["id"]);
|
||||
|
||||
string url = $"http://192.168.0.101:3081/Activity/LightUpChina/Share?userId={App.CurrentUser.Id}";
|
||||
if (type < 2)
|
||||
{
|
||||
if (App.weChatController.IsWeChatAppInstalled())
|
||||
{
|
||||
App.weChatController.ShareWebpageToWX(type, url, "点亮中国活动", "by " + App.CurrentUser.Nickname, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.GUIUtility.systemCopyBuffer = url;
|
||||
browser.GetComponent<UniWebView>().EvaluateJavaScript("alert(\"复制成功\")");
|
||||
}
|
||||
}
|
||||
|
||||
private void StartRide(Dictionary<string, string> args)
|
||||
{
|
||||
var id = int.Parse(args["id"]);
|
||||
App.RouteIdParam = id;
|
||||
if (args.ContainsKey("routeResult"))
|
||||
{
|
||||
Debug.Log(args.ContainsKey("routeResult"));
|
||||
App.routeResult = JsonConvert.DeserializeObject<RouteResult>(args["routeResult"]);
|
||||
}
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
|
||||
private void CloseFunc()
|
||||
{
|
||||
CancelInvoke("StartPageFunc");
|
||||
@@ -59,4 +98,22 @@ public class ActivityController : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
string url { get; set; }
|
||||
|
||||
public void Initial(string url)
|
||||
{
|
||||
this.url = url;
|
||||
Debug.Log(this.url);
|
||||
StartPageFunc();
|
||||
return;
|
||||
if (this.url != url)
|
||||
{
|
||||
this.url = url;
|
||||
StartPageFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
//执行浏览器内刷新或者其他操作
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Assets.Scripts;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class AddressController : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
Dictionary<string, InputField> inputDict;
|
||||
protected override void Awake()
|
||||
{
|
||||
inputDict = new Dictionary<string, InputField>()
|
||||
{
|
||||
{"Name",transform.Find("Main/Name/input").GetComponent<InputField>() },
|
||||
{"Phone",transform.Find("Main/PN/input").GetComponent<InputField>() },
|
||||
{"Address",transform.Find("Main/Addr/input").GetComponent<InputField>() },
|
||||
};
|
||||
inputDict["Name"].text = App.CurrentUser.Contact;
|
||||
inputDict["Phone"].text = App.CurrentUser.ContactPhone;
|
||||
inputDict["Address"].text = App.CurrentUser.ContactAddress;
|
||||
UIManager.AddEvent(transform.Find("Main/BtnJoin").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, async b =>
|
||||
{
|
||||
App.CurrentUser.Contact = inputDict["Name"].text;
|
||||
App.CurrentUser.ContactPhone = inputDict["Phone"].text;
|
||||
App.CurrentUser.ContactAddress = inputDict["Address"].text;
|
||||
var res = await ConfigHelper.userApi.UpdateUserInfo(App.CurrentUser);
|
||||
if (res.result)
|
||||
{
|
||||
Close();
|
||||
UIManager.ShowActivityPanel(App.ActivityUrl);
|
||||
}
|
||||
});
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6337a1358d5d95f4293c650d8486815d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -178,8 +178,6 @@ public class HomeController : PFUIPanel
|
||||
//进入比赛
|
||||
private void GoMatch(BaseEventData e)
|
||||
{
|
||||
UIManager.ShowActivityPanel();
|
||||
return;
|
||||
UIManager.ShowRaceHomePanel();
|
||||
OnExit(e);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user