Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ted Liou tedliou

🎯
Focusing
View GitHub Profile
View SpectrumController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpectrumController : MonoBehaviour
{
public float scale = 100;
public float baseHeight = 1;
public int visible = 128;
public float observe = 2;
View FacebookControllerOK.cs
// Include Facebook namespace
using Facebook.Unity;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class FacebookController : MonoBehaviour
{
View GetHTTPResult.cs
public Text resultText;
private IEnumerator GetResult(string token)
{
var postData = new List<IMultipartFormSection>();
postData.Add(new MultipartFormDataSection("Token", token));
var www = UnityWebRequest.Post("http://192.168.50.150/login.php", postData);
yield return www.SendWebRequest();
View usingUIandNetworking.cs
using UnityEngine.UI;
using UnityEngine.Networking;
View login.php
<?php
if (isset($_POST['Token'])){
$uri = "https://graph.fb.gg/v11.0/me?fields=id%2Cname&access_token=";
$token = $_POST['Token'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $uri . $token);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_exec($curl);
View AuthCallback.cs
private void AuthCallback(ILoginResult result)
{
if (FB.IsLoggedIn)
{
// AccessToken class will have session details
var aToken = AccessToken.CurrentAccessToken;
// Print current access token's User ID
Debug.Log(aToken.UserId);
// Print current access token's granted permissions
foreach (string perm in aToken.Permissions)
View OnLoginBtnClick.cs
public void OnLoginBtnClick()
{
var perms = new List<string>() { "public_profile", "email" };
FB.LogInWithReadPermissions(perms, AuthCallback);
}
View FacebookController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Include Facebook namespace
using Facebook.Unity;
public class FacebookController : MonoBehaviour
{
// Awake function from Unity's MonoBehavior
View NewFontMode.yaml
style: &style
size: 24 # 改字體大小
fonts:
Microsoft JhengHei UI:
replace: 源樣明體 R
<<: *style
fixGSOFont: true # true is to use system UI font
debug: true
View FontMode.yaml
style: &style
# size: 0
# width: 0
# weight: 0
# italic: false
# underLine: false
# strikeOut: false
# charSet: 0
# outPrecision: 0
# clipPrecision: 0