예제 #1
0
    IEnumerator ShowContents(Action onEndContents)
    {
        canvasGroup.alpha = 0f;

        for (int i = 0; i < contents.Length; i++)
        {
            float loopStartTime = Time.time;

            InitContent(i);

            Coroutine fadeIn = UIEffect.Fade(canvasGroup, 1f, 1f);

            Coroutine showEachChar = TaskManager.Delay(1f, () =>
            {
                textComponent.text = contents[i];
                UIEffect.ShowEachChar(textComponent, showCharInterval);
            });

            yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Space) && Time.time - loopStartTime > 1f));

            StopCoroutine(fadeIn);
            StopCoroutine(showEachChar);

            if (i != contents.Length - 1 && images[GetImageIdx(i)] != images[GetImageIdx(i + 1)])
            {
                UIEffect.Fade(canvasGroup, 0f, 1f);

                yield return(new WaitForSeconds(1f));
            }
        }

        onEndContents();
    }
예제 #2
0
        /// <summary>
        /// 状态自动切换的UIEffect
        /// </summary>
        /// <param name="_operateUIEffect">Operate user interface effect.</param>
        public void StateAutoFlip(UIEffect _operateUIEffect)
        {
            if (_operateUIEffect.isSelected)
            {
                _operateUIEffect.isEffectEnable = true;
                _operateUIEffect.UnSelected();
            }
            else
            {
                _operateUIEffect.isEffectEnable = true;
                _operateUIEffect.SetSelected();
            }

            if (allSelectedUIEffect.Contains(_operateUIEffect))
            {
                if (_operateUIEffect.isSelected == false)
                {
                    allSelectedUIEffect.Remove(_operateUIEffect);
                }
            }
            else
            {
                if (_operateUIEffect.isSelected)
                {
                    allSelectedUIEffect.Add(_operateUIEffect);
                }
            }//else
        }
예제 #3
0
        public ImGuiRenderer(Game game, EffectFactory effectFactory)
        {
            var context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);

            this.Game           = game;
            this.Effect         = effectFactory.Construct <UIEffect>();
            this.GraphicsDevice = game.GraphicsDevice;

            this.LoadedTextures = new Dictionary <IntPtr, TextureReference>();

            this.RasterizerState = new RasterizerState()
            {
                CullMode             = CullMode.None,
                DepthBias            = 0,
                FillMode             = FillMode.Solid,
                MultiSampleAntiAlias = false,
                ScissorTestEnable    = true,
                SlopeScaleDepthBias  = 0
            };

            this.TextureContrast = 1.0f;

            this.SetupInput();
            this.RebuildFontAtlas();
        }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     //ImageFade (GameObject.Find ("CG").GetComponent<Image> (), -1, 0.5f);
     //Shake(GameObject.Find("CG"), 2.0f, 0.1f);
     //PrintText(GameObject.Find("Text").GetComponent<Text>(), "The story will be displayed here.", 0.05f);
     instance = this;
 }
예제 #5
0
        public static Material GetOrCreateMaterial(Shader shader, UIEffect.ToneMode tone, UIEffect.ColorMode color, UIEffect.BlurMode blur)
        {
            Material mat = UIEffect.GetMaterial(shader, tone, color, blur);

            if (!mat)
            {
                mat = new Material(shader);

                if (0 < tone)
                {
                    mat.EnableKeyword("UI_TONE_" + tone.ToString().ToUpper());
                }
                if (0 < color)
                {
                    mat.EnableKeyword("UI_COLOR_" + color.ToString().ToUpper());
                }
                if (0 < blur)
                {
                    mat.EnableKeyword("UI_BLUR_" + blur.ToString().ToUpper());
                }

                mat.name = Path.GetFileName(shader.name)
                           + (0 < tone ? "-" + tone : "")
                           + (0 < color ? "-" + color : "")
                           + (0 < blur ? "-" + blur : "");
                //mat.hideFlags = HideFlags.NotEditable;

                Directory.CreateDirectory("Assets/UIEffect/Materials");
                AssetDatabase.CreateAsset(mat, "Assets/UIEffect/Materials/" + mat.name + ".mat");
            }
            return(mat);
        }
예제 #6
0
    void InitEndingList()
    {
        endingList = new List <Ending>();
        List <Type> assemblyTypeList = new List <Type>(GetType().Assembly.GetTypes());

        assemblyTypeList = assemblyTypeList.FindAll((Type t) =>
        {
            return(t.BaseType == typeof(Ending));
        });

        foreach (Type type in assemblyTypeList)
        {
            Ending instance = ScriptableObject.CreateInstance(type) as Ending;
            endingList.Add(instance);
        }

        foreach (Ending ending in endingList)
        {
            GameObject content = GameObject.Find(ending.GetType().Name);

            if (ending.CheckPossibility())
            {
                Button button = content.GetComponent <Button>();
                button.interactable = true;

                button.onClick.AddListener(() =>
                {
                    UIEffect.Fade(canvasGroup, 0f, 1f);
                    TaskManager.Delay(1f, () => ending.LoadEnding());
                });

                content.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ending/Image/el_unlockListItem");
            }
        }
    }
예제 #7
0
    void UpdateSchedule()
    {
        Act act = actList[0];

        if (act.IsEvent)
        {
            dataHolder.GetComponent <Schedule>().progressPoint = progressBar.value;

            act.IsEvent = false; // 더이상 유효하지 않은 이벤트

            SceneManager.LoadScene(act.Name);

            return;
        }

        if (showEachChar != null)
        {
            StopCoroutine(showEachChar);
        }
        CharacterManager.Get_instance().characterStat += act.Changement;

        descText.text    = act.Description;
        showEachChar     = UIEffect.ShowEachChar(descText, .05f);
        behaviour.sprite = Resources.Load <Sprite>("Main/m_schedule/Category/m_" + act.Name);
    }
예제 #8
0
        public IEnumerator ShowAnimation()
        {
            bool turnEndInteractable = View.BattleView.TurnEndButton.interactable;

            View.BattleView.TurnEndButton.interactable = false;
            RectTransform firstObj = unitObjects[0];

            UIEffect.FadeOutPanel(firstObj.gameObject);
            unitObjects.Remove(firstObj);

            for (int i = 0; i < unitObjects.Count; i++)
            {
                StartCoroutine(MoveImagies(unitObjects[i], i));
            }

            yield return(new WaitForSeconds(0.8f));

            firstObj.anchoredPosition = Vector2.right * imageGap * (bufferSize - 1);
            unitObjects.Add(firstObj);

            List <Unit> unitBuffer = BattleManager.instance.UnitBuffer.ToList();

            unitObjects[0].GetComponent <Image>().sprite = BattleManager.instance.thisTurnUnit.Sprite;
            for (int i = 1; i < bufferSize; i++)
            {
                unitObjects[i].GetComponent <Image>().sprite = unitBuffer[i - 1].Sprite;
            }

            UIEffect.FadeInPanel(firstObj.gameObject);
            View.BattleView.TurnEndButton.interactable = turnEndInteractable;
        }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        image     = GetComponent <Image> ();
        _uiEffect = GetComponent <UIEffect>();

        numberText = transform.Find("Text").GetComponent <Text> ();
    }
    /// <returns>
    /// The length of the effect animation clip
    /// </returns>
    public float OnPlayUIEffect(UIEffect uiEffect, UIEffectAnimationClip clipName)
    {
        string   path = string.Join("/", uiEffect.ToString().Split('_'));
        Animator anim = transform.Find(path)?.GetComponentInChildren <Animator>();

        anim?.Play(clipName.ToString());
        return(anim.GetCurrentAnimatorClipInfo(0)[0].clip.length);
    }
예제 #11
0
 void OnEnable()
 {
     uiEffect           = (target as UIShadow).GetComponent <UIEffect>();
     _spStyle           = serializedObject.FindProperty("m_Style");
     _spEffectDistance  = serializedObject.FindProperty("m_EffectDistance");
     _spEffectColor     = serializedObject.FindProperty("m_EffectColor");
     _spUseGraphicAlpha = serializedObject.FindProperty("m_UseGraphicAlpha");
     _spBlurFactor      = serializedObject.FindProperty("m_BlurFactor");
 }
예제 #12
0
    // GameObject instance = ConditionLibrary.Instance.getInstanceByID(conditionID);
    // instanceList.Add(instance);

    public static GameObject setupIcon(GameObject instance, string name, string description, bool timed, float endTime)
    {
        UIEffect e = instance.AddComponent <UIEffect>();

        e.setup(name, description, timed, endTime);
        EffectMouseOver m = instance.AddComponent <EffectMouseOver>();

        m.setup(e);
        return(instance);
    }
예제 #13
0
 private void Start()
 {
     ui = GUI_Referenciador.instancia.GetComponent <GUI_Dialogar>();
     if (imagemAtual == null)
     {
         imagemAtual = gameObject;
         eSprite     = true;
     }
     efeito = GetComponent <UIEffect>();
 }
예제 #14
0
    // Start is called before the first frame update
    void Start()
    {
        contents = textComponent.text.Split('|');

        StartCoroutine(ShowContents(() =>
        {
            UIEffect.Fade(canvasGroup, 0f, 1f);
            TaskManager.Delay(1f, () => SceneManager.LoadScene("Intro"));
        }));
    }
예제 #15
0
 void SetName(string name)
 {
     if (name.Length == 0 || !Input.GetKey(KeyCode.Return))
     {
         return;
     }
     CharacterManager.Get_instance().playerName = name;
     UIEffect.Fade(canvas.GetComponent <CanvasGroup>(), 0f, 1.0f);
     TaskManager.Delay(1.0f, () => SceneManager.LoadScene("Prologue_birthday", LoadSceneMode.Single));
 }
예제 #16
0
 public void setup(UIEffect e)
 {
     panel       = EffectInfoPanel.Instance;
     panelObject = panel.gameObject;
     panel.deactivate();
     active      = false;
     setupNeeded = false;
     Offset      = new Vector3(20, 20, 0);
     EffectData  = e;
 }
예제 #17
0
    public void RemoveModificator(BaseModificator modificator)
    {
        UIEffect effect = modificators.Find(x => x.GetComponent <UIEffect>().modificator == modificator);

        if (effect != null)
        {
            modificators.Remove(effect);
            Destroy(effect.gameObject);
        }
    }
예제 #18
0
    // Start is called before the first frame update
    void Start()
    {
        next_btn.onClick.AddListener(btn_click);
        contents = textComponent.text.Split('|');

        StartCoroutine(ShowContents(() =>
        {
            UIEffect.Fade(canvasGroup, 0f, 1f);
            TaskManager.Delay(1f, () => SceneManager.LoadScene(nextScene));
        }));
    }
예제 #19
0
    void ChangeQuestion()
    {
        yes.gameObject.SetActive(false);
        no.gameObject.SetActive(false);
        report.gameObject.SetActive(true);
        stop.gameObject.SetActive(true);
        StopCoroutine(showEachChar);

        textComponent.text = contentList[1];
        UIEffect.ShowEachChar(textComponent, .1f);
    }
예제 #20
0
 public void Init(int _bufferSize)
 {
     bufferSize = _bufferSize + 1;
     imageGap   = line.rect.width / bufferSize;
     for (int i = 0; i < bufferSize; i++)
     {
         RectTransform newObj = Instantiate(prefab, line);
         unitObjects.Add(newObj);
         newObj.anchoredPosition = new Vector2(i * imageGap, 0);
         UIEffect.FadeInPanel(newObj.gameObject);
     }
 }
예제 #21
0
    // Start is called before the first frame update
    void Start()
    {
        string text = textComponent.text;

        textComponent.text = "";
        TaskManager.Delay(startTime,
                          () =>
        {
            textComponent.text = text;
            UIEffect.ShowEachChar(textComponent, 0.1f);
        });
    }
    private void CreateSfxSourceContainers(Sfx[] effectTypes, string containerName)
    {
        GameObject sfxConteiner = AudioManager.Instance.CreateNewGameObjectContainer(containerName, transform);


        foreach (var UIEffect in effectTypes)
        {
            GameObject musicSourceObject = new GameObject();
            UIEffect.SetSource(musicSourceObject.AddComponent <AudioSource>(), AudioManager.Instance.GetAudioMixerOutputChannel("Sfx"));
            musicSourceObject.name = UIEffect.SoundName;
            musicSourceObject.transform.SetParent(sfxConteiner.transform);
        }
    }
예제 #23
0
    // Start is called before the first frame update
    void Start()
    {
        yes.onClick.AddListener(ChooseY);
        no.onClick.AddListener(ChooseN);
        report.onClick.AddListener(ChooseReport);
        stop.onClick.AddListener(ChooseStop);

        report.gameObject.SetActive(false);
        stop.gameObject.SetActive(false);

        textComponent.text = contentList[0];
        showEachChar       = UIEffect.ShowEachChar(textComponent, .1f);
    }
예제 #24
0
 void Awake()
 {
     CGUI          = GameObject.Find("CG");
     TextUI        = GameObject.Find("Text");
     CGCanvas      = GameObject.Find("CGDisplay");
     effectManager = GetComponent <UIEffect> ();
     CGImage       = CGUI.GetComponent <Image> ();
     textContent   = TextUI.GetComponent <Text> ();
     startC        = GameObject.Find("Start").GetComponent <Text> ();
     modC          = GameObject.Find("Mod").GetComponent <Text> ();
     exitC         = GameObject.Find("Exit").GetComponent <Text> ();
     CGProcess     = 0;
 }
예제 #25
0
 /// <summary>
 ///
 /// </summary>
 public void Start(ControllerEntry context)
 {
     this.context   = context;
     m_Transform    = m_GameObject.transform;
     m_Graphic      = m_GameObject.GetComponent <Graphic>();
     m_DefaultScale = m_Transform.localScale.x;
     // TODO :
     m_UIEffect = m_GameObject.GetComponent <UIEffect>();
     if (m_UIEffect != null)
     {
         m_UIEffect.highlight.onUpdate += OnHighlight;
         m_UIEffect.highlight.onUpdate(0.0f);
     }
 }
예제 #26
0
        //**********PointUpEvent
        /// <summary>
        /// Addlistener to uieffect PointerUpEvent event
        /// </summary>
        /// <param name="effect"></param>
        /// <param name="handle"></param>
        protected void AddUIEffectListener(UIEffect effect, PointerUpDelegate handle)
        {
            if (effect == null)
            {
                return;
            }

            if (m_RegistUIEffect.Contains(effect.GetInstanceID()))
            {
                return;
            }

            m_RegistUIEffect.Add(effect.GetInstanceID());
            effect.PointerUpEvent += handle;  //注册点击的抬起事件
        }
예제 #27
0
        /// <summary>
        /// remove listenner of  PointerUpEvent
        /// </summary>
        /// <param name="effect"></param>
        /// <param name="handle"></param>
        protected void RemoveUIEffectListener(UIEffect effect, PointerUpDelegate handle)
        {
            if (effect == null)
            {
                return;
            }

            if (m_RegistUIEffect.Contains(effect.GetInstanceID()) == false)
            {
                return;
            }

            m_RegistUIEffect.Remove(effect.GetInstanceID());
            effect.PointerUpEvent -= handle;  //注销点击的抬起事件
        }
예제 #28
0
        /// <summary>
        /// 自动反转状态
        /// </summary>
        /// <param name="_operateUIEffect">Operate user interface effect.</param>
        public void AutoFlipSpecialUIEffect(UIEffect _operateUIEffect)
        {
            if (_operateUIEffect == null)
            {
                return;
            }

            if (_operateUIEffect.isSelected)
            {
                ForceUnSelectSpecial(_operateUIEffect);
            }
            else
            {
                ForceSelectSpecial(_operateUIEffect);
            }
        }
예제 #29
0
    private void CheckNextEffects()
    {
        if (effects_cluster.Count > 0)
        {
            List <UIEffect> curr_active_cluster = effects_cluster[0];

            bool finished = true;

            for (int i = 0; i < curr_active_cluster.Count; ++i)
            {
                UIEffect curr_effect = curr_active_cluster[i];

                if (!curr_effect.GetStarted())
                {
                    curr_effect.Start();
                    curr_effect.SetStarted();
                }

                if (!curr_effect.GetFinished())
                {
                    finished = false;
                    break;
                }
            }

            if (finished)
            {
                if (effects_cluster.Count > 0)
                {
                    effects_cluster.RemoveAt(0);

                    if (effects_cluster.Count > 0)
                    {
                        List <UIEffect> new_active_cluster = effects_cluster[0];

                        for (int i = 0; i < new_active_cluster.Count; ++i)
                        {
                            UIEffect curr_effect = new_active_cluster[i];

                            curr_effect.Start();
                            curr_effect.SetStarted();
                        }
                    }
                }
            }
        }
    }
예제 #30
0
    void UpdateEndingList()
    {
        foreach (Ending ending in endingList)
        {
            GameObject content = GameObject.Find(ending.GetType().Name);
            content.GetComponent <Button>().onClick.AddListener(() =>
            {
                if (!ending.CheckPossibility())
                {
                    return;
                }

                UIEffect.Fade(canvasGroup, 0f, 1f);
                TaskManager.Delay(1f, () => ending.LoadEnding());
            });
        }
    }