Skip to content

Instantly share code, notes, and snippets.

@wuqxuan
wuqxuan / 清空文件
Last active August 1, 2018 02:49
python清空file
也可以使用一条命令,直接打开文件写并覆写就会清空(注意,不能使用增加参数'a')
open(filename, 'w').close()
@wuqxuan
wuqxuan / 循环滚屏
Created February 22, 2017 13:22
Unity 循环滚屏
using UnityEngine;
using System.Collections;
public class BackgroundRepeater : MonoBehaviour {
private Transform cameraTransform;
private float spriteWidth;
// Use this for initialization
void Start () {
cameraTransform = Camera.main.transform;
@wuqxuan
wuqxuan / ios app 评论接口
Last active January 21, 2017 08:23
ios app 评论接口
https://itunes.apple.com/rss/customerreviews/id=1038302242/sortby=mostrecent/json?l=en&&cc=cn
https://itunes.apple.com/rss/customerreviews/page=1/id=414478124/sortby=mostrecent/json?l=en&&cc=cn
替换id即可
参考 https://www.zhihu.com/question/23945309
@wuqxuan
wuqxuan / How to get the mouse direction while left click is pressed?
Last active January 19, 2017 04:45
Get the mouse direction while left click is pressed
private var v3Pos : Vector3;
private var threshold = 9;
function OnMouseDown() {
v3Pos = Input.mousePosition;
}
function OnMouseDrag() {
var v3 = Input.mousePosition - v3Pos;
v3.Normalize();
@wuqxuan
wuqxuan / Unity : Adding rate button in my game
Last active February 5, 2024 07:24
Unity : Adding rate button in my game
void OnRateButtonClick(){
#if UNITY_ANDROID
Application.OpenURL("market://details?id=YOUR_APP_ID");
#elif UNITY_IPHONE
Application.OpenURL("itms-apps://itunes.apple.com/app/idYOUR_APP_ID");
#endif
}
http://www.itorn.net/2016/04/25/unity-adding-rate-button-in-my-game/