Skip to content

Instantly share code, notes, and snippets.

View tedliou's full-sized avatar

Ted Liou tedliou

View GitHub Profile
@tedliou
tedliou / 【Visual C#】使用 Random 方法產生不重複亂數
Last active July 14, 2024 10:50
使用Random方法,產生多組亂數值並不重複,存到陣列中,並在控制項中顯示出來。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
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;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using NPOI.SS.Util;
using NPOI.SS.UserModel.Charts;
Test();
void Test()
{
// 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
{
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();
using UnityEngine.UI;
using UnityEngine.Networking;
<?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);
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)
public void OnLoginBtnClick()
{
var perms = new List<string>() { "public_profile", "email" };
FB.LogInWithReadPermissions(perms, AuthCallback);
}
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