// Use this for initialization void Start() { currentSelect = this.GetComponent <selection>(); segment = btSize; posMoveBt = new Rect(leftMargin, topMargin, btSize, btSize); posSummonBt = new Rect(leftMargin, topMargin + segment, btSize, btSize); posAttackBt = new Rect(leftMargin, topMargin + segment * 2, btSize, btSize); posSkillBt = new Rect(leftMargin, topMargin + segment * 3, btSize, btSize); posDefenseBt = new Rect(leftMargin, topMargin + segment * 4, btSize, btSize); posEndTurnBt = new Rect(leftMargin, topMargin + segment * 5, btSize, btSize); MainGuiShow = false; mousePos = new Vector2(); mainStyle.font = MainFont; mainStyle.normal.textColor = Color.white; mainStyle.fontSize = 20; subStyle = new GUIStyle(mainStyle); subStyle.fontSize = 16; subStyle.normal.textColor = new Color(.8f, .8f, .8f, 1.0f); subStyle.onHover.textColor = Color.white; players = this.GetComponent <RoundCounter>(); numIcon = this.GetComponent <NumIconVault>(); infoUI = this.GetComponent <InfoUI>(); chessUI = this.GetComponent <MainInfoUI>(); InSecondTutor = false; init = GameObject.Find("InitStage").transform.GetComponent <InitStage>(); }
static bool OnPrepared(bool forceReady = false) { D.assert(initStage == InitStage.Prepared); if (!forceReady && initialFrameCount >= Time.frameCount) { return(false); } initStage = InitStage.Ready; DoPrepare(); return(true); }
private void InvokeStage(Type type, InitStage stage) { var method = type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public) .Where(m => m.GetCustomAttributes(typeof(R2APISubmoduleInit)) .Any(a => ((R2APISubmoduleInit)a).Stage.HasFlag(stage))).ToList(); if (method.Count == 0) { _logger?.Log(LogLevel.Debug, $"{type.Name} has no static method registered for {stage.ToString()}"); return; } method.ForEach(m => m.Invoke(null, null)); }
static bool OnNotPrepared() { initStage = InitStage.Prepared; initialFrameCount = Time.frameCount; testShader = GetShader(testShaderName); var material = new Material(testShader); //for Unity 2018 or below, shader is compiled after Shader.Find() call immediately, //therefore we can just skip the manually preload if the compilation fails if (!material.shader.isSupported) { ObjectUtils.SafeDestroy(material); return(OnPrepared(true)); } using (var cmdBuf = new CommandBuffer()) { var renderTarget = new RenderTexture(1, 1, 1); cmdBuf.SetRenderTarget(renderTarget); var mesh = new Mesh { vertices = new[] { new Vector3(0, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 1, 0) }, uv = new[] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1) }, triangles = new[] { 0, 1, 2 } }; cmdBuf.DrawMesh(mesh, Matrix4x4.identity, material); cmdBuf.DisableScissorRect(); Graphics.ExecuteCommandBuffer(cmdBuf); ObjectUtils.SafeDestroy(renderTarget); ObjectUtils.SafeDestroy(mesh); } ObjectUtils.SafeDestroy(material); return(false); }
// Use this for initialization void Start() { currentSelect = this.GetComponent<selection>(); segment = btSize; posMoveBt =new Rect(leftMargin,topMargin,btSize,btSize); posSummonBt = new Rect(leftMargin,topMargin+segment,btSize,btSize); posAttackBt = new Rect(leftMargin,topMargin+segment*2,btSize,btSize); posSkillBt = new Rect(leftMargin,topMargin+segment*3,btSize,btSize); posDefenseBt = new Rect(leftMargin,topMargin+segment*4,btSize,btSize); posEndTurnBt = new Rect(leftMargin,topMargin+segment*5,btSize,btSize); MainGuiShow = false; mousePos = new Vector2(); mainStyle.font = MainFont; mainStyle.normal.textColor = Color.white; mainStyle.fontSize = 20; subStyle = new GUIStyle(mainStyle); subStyle.fontSize = 16; subStyle.normal.textColor = new Color(.8f,.8f,.8f,1.0f); subStyle.onHover.textColor = Color.white; players = this.GetComponent<RoundCounter>(); numIcon = this.GetComponent<NumIconVault>(); infoUI = this.GetComponent<InfoUI>(); chessUI = this.GetComponent<MainInfoUI>(); InSecondTutor = false; init = GameObject.Find("InitStage").transform.GetComponent<InitStage>(); }
public static void AddLevel(InitStage init_func) { stages.Add(init_func); }
public FixOn(InitStage stage) => this.stage = stage;