コード例 #1
0
        void Awake()
        {
            BillboardPrefab t = target as BillboardPrefab;

            if (t == null)
            {
                return;
            }

            if (t._TargetPrefab != null)
            {
                return;
            }

            //快速預選 Character_Erica
            var results = AssetDatabase.FindAssets("Character_Erica");

            foreach (string guid in results)
            {
                UIBillboardController temp = (UIBillboardController)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(UIBillboardController));
                t._TargetPrefab = temp;
                //EditorUtility.SetDirty(t);
                break;
            }
        }
コード例 #2
0
        public void InitializeByParams(object[] param)
        {
            CommandParam data = param[0] as CommandParam;

            UIBillboardController _prefab = null;

            AdvKeyContent ADVKeys = AdvKeyContent.GetCurrentInstance();

            if (ADVKeys != null)
            {
                _prefab = ADVKeys.GetBillboardPrefabByKey(data.image);
                if (_prefab != null)
                {
                    if (!string.IsNullOrEmpty(data.name))
                    {
                        useBody = data.name;
                    }

                    if (!string.IsNullOrEmpty(data.arg2))
                    {
                        string[] splite = data.arg2.Split('|');
                        useEquips = new List <string>();
                        foreach (var item in splite)
                        {
                            useEquips.Add(item);
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(data.image))
                {
                    AdvUtility.LogWarning("找不到Billboard prefab檔:" + data.image + " , 於 行數 " + (this.itemId - 3));
                    if (Application.isPlaying)
                    {
                        //_diceSprite = AdvManager.Instance.DefaultDiceSprite;
                    }
                }
            }

            targetPrefab       = _prefab;
            display            = StageExtend.GetDisplayTypeByCommand(data.command);
            spriteDistance     = StageExtend.GetBbDistanceByString(data.arg1);
            toPosition         = StageExtend.GetBbPositionByString(data.target);
            hideWhich          = StageExtend.GetBbHideByString(data.target);
            useDefaultSettings = true;
        }
コード例 #3
0
    public UIBillboardController FindBillboardWithTerm(string term)
    {
        foreach (var item in billboardOnStage)
        {
            if (item == null)
            {
                continue;
            }
            UIBillboardController uiData = item.GetComponent <UIBillboardController>();
            if (uiData == null)
            {
                continue;
            }

            if (uiData.DataTerm == term)
            {
                return(uiData);
            }
        }
        return(null);
    }
コード例 #4
0
        public override void OnEnter()
        {
            System.Action <GameObject> onSpawn = (obj) => {
                UIBillboardController copyController = obj.GetComponent <UIBillboardController>();
                if (copyController != null)
                {
                    copyController.SetInitDisplay(useEmoji, useBody, useEquips);
                }
            };

            BillboardOptions options = new BillboardOptions();

            options.display            = display;
            options.fromPosition       = fromPosition;
            options.toPosition         = toPosition;
            options.toPositionShift    = positionShift;
            options.shiftAmount        = positionShiftAmount;
            options.toDistance         = spriteDistance;
            options.hideWhich          = hideWhich;
            options.flipFace           = flipFace;
            options.useDefaultSettings = useDefaultSettings;
            options.fadeDuration       = fadeDuration;
            options.moveDuration       = moveDuration;
            options.shiftOffset        = shiftOffset;
            options.move              = move;
            options.shiftIntoPlace    = shiftIntoPlace;
            options.waitUntilFinished = waitUntilFinished;

            StageExtend   targetStage = AdvManager.Instance.advStage;
            RectTransform prefabRect  = null;

            if (targetPrefab != null)
            {
                prefabRect = targetPrefab.GetComponent <RectTransform>();
            }

            targetStage.BillboardGUILayout.RunBillboardGUIObjCommand(prefabRect, options, onSpawn, Continue); // 已在 callback 加上 Continue, 因此此指令執行完時直接 Continue
        }
コード例 #5
0
ファイル: SayExtend.cs プロジェクト: Hengle/AdvSystemV3
        public override void OnEnter()
        {
            if (!showAlways && executionCount >= showCount)
            {
                Continue();
                return;
            }

            executionCount++;

            // Override the active say dialog if needed
            if (dataCharacter != null && dataCharacter.SetSayDialog != null)
            {
                SayDialog.ActiveSayDialog = character.SetSayDialog;
            }

            if (setSayDialog != null)
            {
                SayDialog.ActiveSayDialog = setSayDialog;
            }

            // Default say dialog is AdvManager's
            var sayDialog = AdvManager.Instance.advSayDialog;

            if (sayDialog == null)
            {
                Continue();
                return;
            }

            var flowchart = GetComponent <FlowchartExtend>();

            bool isRead = false;

            if (AdvManager.Instance.HasReadTable.TryGetValue($"{gameObject.name}.{csvCommandKey}", out isRead))
            {
                hasRead = true;
            }

            sayDialog.SetActive(true);

            //1. Set name , color , portait
            string nameTerm   = overrideTerm;
            string stringName = "";

            if (!string.IsNullOrEmpty(overrideTerm))
            {
                stringName = LocalizeManager.GetLocalizeName(overrideTerm);
                stringName = string.IsNullOrEmpty(stringName) ? $"no key:{overrideTerm}" : stringName;
            }

            Color nameColor;
            Color contentColor;

            nameColor    = sayDialog.ColorName.TryGetValue(overrideTerm, out nameColor) ? nameColor : AdvProjectConfig.Instance.SaySpeakerColor;
            contentColor = sayDialog.ColorText.TryGetValue(overrideTerm, out contentColor) ? contentColor : AdvProjectConfig.Instance.SayContentColor;

            sayDialog.SetCharacter(stringName, nameColor, overridePortrait);
            sayDialog.SetStoryColor(contentColor);

            //2. Set Content text
            string displayText = storyText;
            string textTerm    = $"{flowchart.GoogleSheetID}.{flowchart.GooglePageID}.{CSVCommandKey}";
            string localText   = LocalizeManager.GetLocalizeText(textTerm);

            if (!string.IsNullOrEmpty(localText))
            {
                displayText = localText;
            }

            var activeCustomTags = CustomTag.activeCustomTags;

            for (int i = 0; i < activeCustomTags.Count; i++)
            {
                var ct = activeCustomTags[i];
                displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
                if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
                {
                    displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
                }
            }
            string subbedText = flowchart.SubstituteVariables(displayText); //displayText is origin Tag string , subbedText is Replace by Variables Text

            //3. Set Icon show / hide
            sayDialog.SetIconDisplay(showIcon);

            // //如果立繪中有存在這個 SpeakerTerm , 啟用立繪相關功能
            // BillboardController billboardCtrl = null;
            // if(!string.IsNullOrEmpty(speakerTerm.ToString())){
            //     billboardCtrl = AdvManager.Instance.mainStage.BillboardLayout.FindBillboardWithTerm(speakerTerm);
            // }
            // if(billboardCtrl != null){
            //     //關閉頭相框
            //     sayDialog.SayIconObject.SetActive(false);

            //     //從 atlas 取得說話表情
            //     billboardCtrl.SetRendererSprite(portrait);
            //     AdvManager.Instance.mainStage.BillboardLayout.PopUpBillboard(billboardCtrl);
            // }
            // else
            // {
            //     AdvManager.Instance.mainStage.BillboardLayout.ResumeBillboardPop();
            // }

            //4. Set billboard on Stage
            UIBillboardController uiCtrl = null;

            if (!string.IsNullOrEmpty(overrideTerm))
            {
                uiCtrl = AdvManager.Instance.advStage.BillboardGUILayout.FindBillboardWithTerm(overrideTerm);
            }
            if (uiCtrl != null)
            {
                //關閉頭相框
                if (AdvProjectConfig.Instance.AlwaysHideIconWhenOnBillboard)
                {
                    sayDialog.SayIconObject.SetActive(false);
                }

                if (overridePortrait)
                {
                    uiCtrl.RuntimeSetEmoji(overridePortrait.name);
                }

                uiCtrl.RuntimeUnequip();
                uiCtrl.RuntimeSetEquip(portraitEquip);
            }
            else
            {
            }


            sayDialog.SetLogInfo(nameTerm, textTerm, voiceOverClip);

            sayDialog.Say(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, waitForVO, voiceOverClip, hasRead, delegate {
                //已經確定讀完這句話了
                AdvManager.Instance.OnSayRead?.Invoke(gameObject.name, csvCommandKey);
                hasRead = true;

                Continue();
            });
        }