Harigami
ログイン
1
anonymous タイトルなし
C#
/*投稿テスト*/

        // 時間パラメータ群とI/F
        private class TimeConfig
        {
            // タイマー割り込み発生の間隔
            public int TimerInterval;

            // 下記のTime系変数の単位はミリ秒か?秒か?
            public bool IsMilliSec;

            // Time変数群
            public int Time1Hour;
            public int Time10Min;
            public int Time1Min;
            public int Time10Sec;
            public int Time1Sec;
            public int TimeMax;

            public TimeConfig(bool msec)
            {
                InitConfig(msec);
            }

            public void InitConfig(bool msec)
            {
                IsMilliSec = msec;
                TimerInterval = msec ? 100 : 1000;
                Time1Hour = msec ? 36000 : 3600;
                Time10Min = msec ? 6000 : 600;
                Time1Min = msec ? 600 : 60;
                Time10Sec = msec ? 100 : 10;
                Time1Sec = msec ? 10 : 1;
                TimeMax = msec ? (3600000 - 1) : (360000 - 1);
            }
        }
  • 0
  • 0
anonymous タイトルなし
C#
// Namespace: Imas
public class FaceCtrl // TypeDefIndex: 10695
{
	// Fields
	private float[,] lipParam =  // 0x8
	{
	    { 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, // 歯を食いしばらないように制限している
	    { 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 38.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	    { 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
	};
	public static string[] lipChar; // 0x0
	public static string[] facialMenu; // 0x4
	private DanceIdolInfo info; // 0xC
	public bool singing; // 0x10
	public bool eyesBlink; // 0x11
	public bool talking; // 0x12
	private bool lipOpen; // 0x13
	public bool eyesClose; // 0x14
	private bool lastEyesClose; // 0x15
	private float eyeTransTimer; // 0x18
	private bool eyeToClose; // 0x1C
	private bool lipChanged; // 0x1D
	private const float cheekTransTime = 0.1; // 0x0
	public float cheekBaseIntensity; // 0x20
	public int cheekLV; // 0x24
	private int cheeklastLV; // 0x28
	private float cheektranstimer; // 0x2C
	private const int mouthShapes = 14; // 0x0
	private const int eyeShapes = 18; // 0x0
	private MeshBlendParam[] expressions; // 0x30
	private FaceBlendParam[] paramsrc; // 0x34
	private float[] mouthOpenBuff; // 0x38
	private float[] mouthCloseBuff; // 0x3C
	private float[] mouthMixBuff; // 0x40
	private float[] eyeOpenBuff; // 0x44
	private float[] eyeCloseBuff; // 0x48
	private SkinnedMeshRenderer render; // 0x4C
	private Material face_material; // 0x50
	private CharacterDrawer drawer; // 0x54
	private int shaderPropID_IsReddish; // 0x58
	private int shaderPropID_ReddishIntensity; // 0x5C
	private const float flapOpenTime = 0.125; // 0x0
	private const float flapCloseTime = 0.225; // 0x0
	private const float flapTransTime = 0.07; // 0x0
	private float nextflaptime; // 0x60
	private bool mouthopen; // 0x64
	private float flaptranstimer; // 0x68
	private float flapopenscale; // 0x6C
	private const float eyeBlinkTime = 0.1; // 0x0
	private float nextblinktime; // 0x70
	private const float lipTransitionTime = 0.2; // 0x0
	private float lipNexttime; // 0x74
	public int curLip; // 0x78
	private int nextLip; // 0x7C
	private const float faceTransitionTime = 0.1333333; // 0x0
	private float faceNexttime; // 0x80
	public int curFace; // 0x84
	private int nextFace; // 0x88
	private bool lipTestMode; // 0x8C
	private float lipValue; // 0x90

	// Methods
	public void .ctor(string objname, DanceIdolInfo info0); // 0x696D40
	public static FaceBlendParam[] BlendParamLoad(string json); // 0x697048
	public static IEnumerable`1<FaceBlendParam> BlendParamLoadStep(IList topArray); // 0x6974CC
	public void Init(FaceBlendParam[] param) { // 0x697564
		for(int i = 0; i < param.Length; i++) {
			if(!string.Equals(param[i].cid, this.info.facialID))
				continue;
			
			// As the cid has been matched now load the expressions
			this.expressions = param[i].expressions;
			
			// Lip Relevant weight is the first 14 of 32 params
			for(int i = 0; i < 14; i++) {
				mouthOpenBuff[i] = expressions[0].param32Open[i];
				mouthCloseBuff[i] = expressions[0].param32Close[i];
			}
			
			for(int i = 14; i < 33; i++) {
				eyeOpenBuff[i - 14] = param32Open[i];
				eyeCloseBuff[i - 14] = param32Close[i];
			}
			
			if(this.cheekLV != 0) {
				this.cheeklastLV = this.cheekLV;
				this.cheekLV = 0;
				this.cheektranstimer = 0.1f;
			}
			
			this.eyeclose = false;
			this.talking = false;
			
			break;
		}
	}
	public void Init2() // 0x697928
	{
		if(this.paramsrc != null)
			this.Init(this.paramsrc);
		
		this.singing = true;
		this.eyeTransTimer = 0.0f;
		this.lipChanged = false;
		this.cheektranstimer = 0.0f;
		this.flaptranstimer = 0.0f;
		this.lipTestMode = false;
		this.lipValue = 0.0f;
		this.lipNextTime = 0.0f;
		this.lastEyeClose = false;
		this.eyesBlink = false;
		this.talking = false;
		this.lipOpen = false;
		this.eyesClose = false;
		this.curLip = -1;
		this.nextLip = -1;
		this.curFace = 0;
		this.nextFace = 0;
		this.nextblinktime = 1.2f;
		this.nextflaptime = 0.0f;
		this.cheekLV = 0;
		this.cheeklastLV = 0;
		this.eyeToClose = false;
		this.mouthopen = false;
		this.faceNextTime = 0.0f;
		
		this.SetFaceDirectNow(0);
		this.SetCheekDirect(0);
		this.eyeClose = false;
		
		this.SetFaceDirect(this.curFace);
		this.talking = false;
	}
	// リップのインデックスをlipParamのインデックスに変換します
	private int ConvLip(int n) // 0x698290
	{	
		if(n == 50) // "N"
			return 5;
		else if(n == 54) // 閉じ
			return -1;
		else {
			if(unchecked((uint)(n-55)) > 4)
				return n % 5;
			else // n = 55 ~ 59
				return n - 49;
		}
	}
	public void SetCheekDirect(int lv); // 0x69800C
	// チークの変更をキューします(0.1秒のトランジションタイムによってなめらかに切り替わります)
	public void SetCheek(int lv) { // 0x6978EC
		if(this.cheekLV != lv) {
			this.cheeklastLV = this.cheekLV;
			this.cheekLV = lv;
			this.cheektranstimer = 0.1f;
		}
	}
	public void SetEyeCloseDirect(bool sw); // 0x698284
	public void SetEyeClose(bool sw); // 0x69790C
	public void SetLipOpen(bool sw); // 0x6986E0
	public void SetLipOpenDirect(bool sw); // 0x6986F0
	public void SetTalking(bool sw); // 0x697914
	public void SetTestLip(float val); // 0x698870
	public void SetTestLipEnable(bool enabled); // 0x698878
	public void SetLipDirect(int n); // 0x698880
	public void SetSinging(bool sw); // 0x698AEC
	// リップの変更をキューします。(0.2秒のトランジションタイムによってなめらかに切り替わります)
	public void SetLip(int n) // 0x698A68
	{
		if(this.singing) {
			int specifiedLip = ConvLip(n);
			
			if(this.nextLip != specifiedLip) {
				if(this.curLip != this.nextLip) {
					this.lipNextTime = 0;
					this.curLip = this.nextLip;
				}
				this.nextLip = specifiedLip;
				this.lipNextTime = 0.2f;
			}
		}
	}
	// 表情をトランジションタイム無しで適用します。
	public void SetFaceDirect(int n) // 0x6982D4
	{
		this.SetFace(n);
		
		this.curFace = n;
		this.faceNextTime = 0.0f;
		this.nextblinktime = 0.0f;
			
		if(this.curLip == -1) {
			for(int i = 0; i < 14; i++) {
				this.mouthOpenBuff[i] = this.expressions[n].param32Open[i];
				this.mouthCloseBuff[i] = this.expressions[n].param32Close[i];
				this.SelectMouth();
				
				this.render.SetBlendShapeWeight(i, mouthMixBuff[i]);
			}
		}
		
		for(int i = 14; i < 32; i++)
			this.render.SetBlendShapeWeight(i,
				this.eyeClose ? this.expressions[n].param32Close[i] : this.expressions[n].param32Open[i]);
		
		float scale = (this.eyeClose ? this.expressions[n].param32Close[32] : this.expressions[n].param32Open[32]) * 0.01;
		if(scale != 0.0f)
			scale = 1.0 / scale;
		this.model.EyeTarget.scale = scale;
	}
	public void SetFaceDirectNow(int n); // 0x6979DC
	public void SetFace(int n) // 0x698B38
	{
		if(n != this.nextFace) {
			if(n != this.curFace) {
				this.faceNextTime = 0.0f;
				this.curFace = this.nextFace;
			}
			this.nextFace = n;
			this.faceNextTime = 0.13333333333f; // 7.5分の1秒
		}
	}
	// 表情をSkinnedMeshRendererに反映します。
	private void FaceCalc() { // 0x698C60
		this.faceNextTime -= Time.deltaTime;
		float weight, weight2; // curFaceとnextFaceのウェイト(各0~1)
		bool faceBuffChanged = false; // eyeOpen/CloseBuffが変更されたか(EyesBlink用)
		
		if(this.faceNextTime != 0.0f) {
			if(this.faceNextTime <= 0.0f) {
				this.faceNextTime = 0.0f;
				this.curFace = nextFace;
			}
			// curFaceとnextFaceの重みを計算
			weight = this.faceNextTime * 7.5f; //faceNextTime(最大7.5分の1秒)から重み(0~1)を計算する
			weight2 = 1.0f - weight;
			
			// mouthBuffを重みに基づいてブレンド
			for(int i = 0; i < 14; i++) {
				mouthOpenBuff[i] = expressions[curFace].param32open[i] * weight + expressions[nextFace].param32open[i] * weight2;
				mouthCloseBuff[i] = expressions[curFace].param32close[i] * weight + expressions[nextFace].param32close[i] * weight2;
			}
			
			// lipの状態に応じてmouthmMixBuffにさっきのBuffをロードする(LipCalc用)
			this.SelectMouth();
			
			if(this.curLip == -1)
				this.lipChanged = true;
			
			// eyeBuffを重みに基づいてブレンド
			for(int i = 14; i < 33; i++) {
				eyeOpenBuff[i] = expressions[curFace].param32open[i] * weight + expressions[nextFace].param32open[i] * weight2;
				eyeCloseBuff[i] = expressions[curFace].param32close[i] * weight + expressions[nextFace].param32close[i] * weight2;
			}
			
			// EyeTargetのScaleを修正
			float scale = this.eyesOpen ? eyeOpenBuff[18] : eyeCloseBuff[18];
			scale = (scale * 0.01) == 0.0f ? scale * 0.01f : 1.0 / (scale * 0.01f);
			this.info.model.EyeTarget.scale = scale;
			
			faceBuffChanged = true;
		}
		// 表情を反映
		this.EyesBlink(faceBuffChanged);
		
		// もしリップシンクなしならSelectMouthを強制的に行う
		if(this.curLip == -1)
			this.SelectMouth();
		
		// あとはライブ時には関係ない処理(lipTestMode, talking)
	}
	// リップをSkinnedMeshRendererに反映します。
	private void LipCalc() // 0x6997A0
	{
		if(!lipTestMode) {
			if(this.lipNextTime != 0.0f) {
				// prevNextTime <= 1.0f because this.lipNextTime <= 0.2f
				float prevNextTime = this.lipNextTime * 5.0f; // lipNextTime(最大0.2秒)からウエイト(0~1)を計算
				this.lipNextTime -= UnityEngine.Time.deltaTime;
				
				// it's time to update the lip
				if(this.lipNextTime < 0.0f) {
					this.lipNextTime = 0.0f;
					prevNextTime = 0.0f;
					this.curLip = this.nextLip;
					for(int i = 0; i < 14; i++)
						if(this.curLip == -1) // Closing
							this.render.SetBlendShapeWeight(i, mouthmixBuff[i]);
						else 
							this.render.SetBlendShapeWeight(i, lipParam[this.curLip, i]);
				}
				
				for(int i = 0; i < 14; i++) {
					float weight, weight2;
					if(this.curLip < 0) // リップシンクなしならFaceCalcで計算した値を使用
						weight = mouthmixBuff[i];
					else
						weight = lipParam[curLip, i];
					
					if(this.nextLip < 0) // リップシンクなしならFaceCalcで計算した値を使用
						weight2 = mouthmixBuff[i];
					else 
						weight2 = lipParam[nextLip, i];
					
					this.render.SetBlendShapeWeight(i, prevNextTime * weight + (1.0f - prevNextTime) * weight2);
				}
				this.lipChanged = false;
			}
			else if(this.curLip == -1 && this.talking)
				this.lipChanged = true;
			else
				this.lipChanged = false;
		}
		else
			this.lipChanged = true;
		
		if(this.lipChanged) {
			for(int i = 0; i < 14; i++) {
				if(this.curLip == -1) // Closing
					this.render.SetBlendShapeWeight(i, mouthmixBuff[i]);
				else 
					this.render.SetBlendShapeWeight(i, lipParam[this.curLip, i]);
			}
		}
	}
	private void SelectMouth() // 0x698B6C
	{
		if(this.lipOpen)
			for(int i = 0; i < 14; i++)
				mouthMixBuff[i] = mouthOpenBuff[i];
		else
			for(int i = 0; i < 14; i++)
				mouthMixBuff[i] = mouthCloseBuff[i];
	}
	// faceBuff(eyeOpenBuff,eyeCloseBuff)を適用します、瞬きが有効ならその処理も行います。
	private void EyesBlink(bool faceBuffChanged) { // 0x69960C
		if(!this.eyesBlink) { // まばたきなし
			if(eyesClose == lastEyesClose && eyeTransTimer <= 0.0f) { // 目の状態変化なし
				if(faceBuffChanged) // Buff変化時のみ反映
					this.SetFaceBlink(this.eyesClose ? 0.0f : 1.0f);
			}
			else { // 目の状態変化あり(開閉の変更またはトランジション中)
				if(eyesClose != lastEyesClose) { // フラグが変化していれば更新・トランジションタイムリセット
					this.lastEyesClose = this.eyesClose;
					this.eyeToClose = this.eyesClose;
					this.eyeTransTimer = eyeBlinkTime;
				}
				this.eyeTransTimer -= Time.deltaTime;
				
				if(eyeTransTimer > 0.0f) { // トランジション中
					// トランジションタイムから目の閉じ具合を求める
					float eyeCloseRatio = (this.eyeToClose ? (eyeBlinkTime - this.eyeTransTimer) : this.eyeTransTimer) / eyeBlinkTime;
					this.SetFaceBlink(eyeCloseRatio);
				}
				else { // トランジション後
					this.eyeTransTimer = 0.0f;
					if(this.eyeToClose) // 閉じに向かっていたなら完全に閉じる
						this.SetFaceBlink(1.0f);
					else // 開きに向かっていたなら完全に開く
						this.SetFaceBlink(0.0f);
				}
			}
		}
		else { // まばたきあり
			this.nextBlinkTime -= Time.deltaTime;
			if(this.nextBlinkTime > 0.0f) {
				if(this.nextBlinkTime <= 0.1f) { // 開きフェーズ
					// トランジションタイムから目の閉じ具合を求める
					float eyeCloseRatio = this.nextBlinkTime / eyeBlinkTime;
					this.SetFaceBlink(eyeCloseRatio);
				}
				else if(this.nextBlinkTime < 0.2f) { // 閉じフェーズ
					// トランジションタイムから目の閉じ具合を求める
					float eyeCloseRatio = (0.2f - this.nextBlinkTime) / eyeBlinkTime;
					this.SetFaceBlink(eyeCloseRatio);
				}
				else // まだまばたきは行わない
					this.SetFaceBlink(0.0f);
			}
			else { // まばたきし終わったあとだったら、次のblinktimeを設定する
				this.SetFaceBlink(0.0f);
				this.nextBlinkTime = Random.Range(0.0f, 1.0f) + 4.0f;
			}
		}
	}
	
	// faceBuffを反映します。valは目の閉じ具合です。
	private void SetFaceBlink(float val) { // 0x699BB8
		float openWeight = 1.0f - val;
		float closeWeight = val;
		
		for(int i = 0; i < 18; i++)
			this.render.SetBlendShapeWeight(i + 14, eyeOpenBuff[i]*openWeight + eyeCloseBuff[i]*closeWeight);
	}
	// チークをSkinnedMeshRendererに反映します。
	private void CheekCalc() { // 0x699C88
		float fval = 0.0f; // チークの値
		if(this.cheektranstimer != 0.0f) {
			this.cheektranstimer -= Time.deltaTime;
			if(this.cheektranstimer <= 0.0f) {
				this.cheektranstimer = 0.0f;
				if(cheekLV < 1)
					fval = 0.0f;
				else {
					fval = this.cheekBaseIntensity;
					if(cheekLV == 1)
						fval *= 0.5f;
				}
			}
			else { // トランジション中
				float lastval = 0.0f // トランジション元のチークの値
				if(cheeklastLV >= 1) {
					lastval = this.cheekBaseIntensity;
					if(cheeklastLV == 1)
						lastval *= 0.5f;
				}
				
				float destval = 0.0f; // トランジション先のチークの値
				if(this.cheekLV >= 1) {
					lastval = this.cheekBaseIntensity;
					if(cheekLV == 1)
						destval *= 0.5f;
				}
				
				float transweight = this.cheektranstimer / cheekTransTime; // トランジションの重み
				
				fval = lastval*transweight + destval*(1.0f-transweight);
			}
			// 反映
			this.SetCheekValue(fval);
		}
	}
	private float GetCheekValue(int lv); // 0x699D8C
	private void SetCheekValue(float val) { // 0x699DB8
		/* シェーダー依存コード */
	}
	// 現在のステートをSkinnedMeshRendererに反映します。(表情・リップ・チーク)
	public void Action() // 0x69A000
	{
		this.FaceCalc();
		this.LipCalc();
		this.CheekCalc();
	}
	public void SetFaceMaterial(Material material); // 0x69A024
	public void SetCharacterDrawer(CharacterDrawer drawer); // 0x69A02C
	public void _Set_lastEyesClose(bool last_eyes_close); // 0x69A034
	private float GetDeltaTime(); // 0x699600
	private static void .cctor(); // 0x69A048
}

// Namespace: Imas
public class MeshBlendParam // TypeDefIndex: 10693
{
	// Fields
	public float[] param32open; // 0x8
	public float[] param32close; // 0xC

	// Methods
	public void .ctor(); // 0x9AD0AC
}

// Namespace: Imas
public class FaceBlendParam // TypeDefIndex: 10694
{
	// Fields
	public string cid; // 0x8
	public MeshBlendParam[] expressions; // 0xC

	// Methods
	public void .ctor(); // 0x696C2C
}

il2cpp_array_new_full(Il2CppClass* array_class, il2cpp_array_size_t *lengths, il2cpp_array_size_t * lower_bounds) {
	int num = 0, num2 = 0;
	void * data_start;
	if(array_class->rank == 1) {
		if(array_class->byval_arg->attr & 0xFF0000 == 0x1D0000 || (num = 8, lower_bounds != nullptr) && *lower_bounds != 0) {
			if(*lengths < 0)
				throw gcnew System::OverFlowException("Arithmetic operation resulted in an overflow.");
			data_start = array_class->element_size * *lengths;
		}
	}
	else if (array_class->rank == 0) {
		
	}
}
  • 0
  • 1
anonymous タイトルなし
C#
sing System;

public class Hello{
  public static void Main(){
    Console.WriteLine("hello world!_test1012");
  }
}
  • 0
  • 1
anonymous タイトルなし
C#
💩
  • 0
  • 0
anonymous 数値入力用のTextBox
C#
using System;
using System.Windows.Forms;

namespace NumBox2
{
    // ボックスに入力された文字列を数値へ変換する
    public partial class NumBox : TextBox
    {
        // Textが変更されるたびに数値を計算しなおすようにする
        // TextChangedイベントを発生させるメソッドであるところのOnTextChangedをオーバーライドする
        protected override void OnTextChanged(EventArgs e)
        {
            base.OnTextChanged(e);
            bool _ = double.TryParse(Text, out double res);
            this.ValText = res;
        }

        // NumBoxから他のコントロールへ移動するタイミングで表示を更新する
        protected override void OnLeave(EventArgs e)
        {
            base.OnLeave(e);
            this.Text = this.ValText.ToString();
        }

        // NumBoxにフォーカスしたらIMEをオフにする
        // (Win8以降ではImeModeが正常に働かないようなので注意)
        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            this.ImeMode = ImeMode.Off;
        }

        // Textを数値に変換した結果が入る(読み取り専用)
        public double ValText { get; private set; } = 0;
    }
}
  • 0
  • 1
anonymous タイトルなし
C#
void Add_Damage(float damage, bool ignoreDefence = false)
{
	float discount = 20f;
	float defense_coef = 1f - CS_Player_Status.Defense / discount;
	if( ignoreDefence )
	{
		defense_coef = 1f;
	}
	if( damage * defense_coef > CS_Player_Status.Shield_Now )
	{
		Game_Over();
	}
	CS_Player_Status.Shield_Now -= damage * defense_coef;

	Debug.Log("ダメージ係数"+defense_coef);
	Debug.Log(damage * defense_coef);
}
  • 0
  • 1
あなたもコードを投稿しませんか?
投稿する
1