예제 #1
0
        //********初期化********//
        public virtual void Init(AdvGraphicLayer layer, AdvGraphicInfo graphic)
        {
            this.layer         = layer;
            this.rectTransform = this.transform as RectTransform;
            this.rectTransform.SetStretch();

            if (graphic.RenderTextureSetting.EnableRenderTexture)
            {
                InitRenderTextureImage(graphic);
            }
            else
            {
                GameObject child = this.transform.AddChildGameObject(graphic.Key);
                this.TargetObject = this.RenderObject = child.AddComponent(graphic.GetComponentType()) as AdvGraphicBase;
                this.TargetObject.Init(this);
            }

            //リップシンクのキャラクターラベルを設定
            LipSynchBase lipSync = TargetObject.GetComponentInChildren <LipSynchBase>();

            if (lipSync != null)
            {
                lipSync.CharacterLabel = this.gameObject.name;
                lipSync.OnCheckTextLipSync.AddListener(
                    (x) =>
                {
                    x.EnableTextLipSync = (x.CharacterLabel == Engine.Page.CharacterLabel && Engine.Page.IsSendChar);
                });
            }

            this.FadeTimer   = this.gameObject.AddComponent <Timer>();
            this.effectColor = this.GetComponentCreateIfMissing <AdvEffectColor>();
            this.effectColor.OnValueChanged.AddListener(RenderObject.OnEffectColorsChange);
        }
예제 #2
0
        //強調表示(グレーアウト無視)するか
        bool IsLightingCharacter(AdvPage page, AdvGraphicLayer layer)
        {
            //しゃべっているキャラ
            if ((Mask & LightingMask.Talking) == LightingMask.Talking)
            {
                if (layer.DefaultObject.name == page.CharacterLabel)
                {
                    return(true);
                }
            }

            //ページ内の新規キャラ
            if ((Mask & LightingMask.NewCharacerInPage) == LightingMask.NewCharacerInPage)
            {
                if (pageBeginLayer.Find(x => (x != null && x.DefaultObject != null) && (x.DefaultObject.name == layer.DefaultObject.name)) == null)
                {
                    return(true);
                }
            }

            //名前指定のあるキャラ
            if (NoGrayoutCharacters.Exists(x => x == layer.DefaultObject.name))
            {
                return(true);
            }
            return(false);
        }
 internal virtual void Init(AdvGraphicLayer layer)
 {
     this.layer = layer;
     EffectColors.OnValueChanged = OnEffectColorsChange;
     IsLoading = true;
     OnInit();
 }
예제 #4
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string          layerName = reader.ReadString();
                AdvGraphicLayer layer     = FindLayer(layerName);
                if (layer != null)
                {
                    reader.ReadBuffer(layer.Read);
                }
                else
                {
                    reader.SkipBuffer();
                }
            }
        }
예제 #5
0
        public GameObject FindTarget(AdvEffectData data)
        {
            switch (data.Target)
            {
            case AdvEffectData.TargetType.MessageWindow:
                return(MessageWindow.gameObject);

            case AdvEffectData.TargetType.Graphics:
                return(Engine.GraphicManager.gameObject);

            case AdvEffectData.TargetType.Camera:
                return(CameraRoot);

            case AdvEffectData.TargetType.Default:
            default:
            {
                AdvGraphicObject obj = engine.GraphicManager.FindObject(data.TargetName);
                if (obj != null && obj.gameObject != null)
                {
                    return(obj.gameObject);
                }
                AdvGraphicLayer layer = engine.GraphicManager.FindLayer(data.TargetName);
                if (layer != null)
                {
                    return(layer.gameObject);
                }
                Transform ui = engine.UiManager.transform.Find(data.TargetName);
                if (ui != null)
                {
                    return(ui.gameObject);
                }
                return(null);
            }
            }
        }
        public override void DoCommand(AdvEngine engine)
        {
            float           fadeTime         = engine.Page.ToSkippedTime(this.time);
            AdvGraphicGroup characterManager = engine.GraphicManager.CharacterManager;

            if (string.IsNullOrEmpty(this.name))
            {
                characterManager.FadeOutAll(fadeTime);
            }
            else
            {
                AdvGraphicLayer layer = characterManager.FindLayerFromObjectName(this.name);
                if (layer != null)
                {
                    layer.FadeOut(this.name, fadeTime);
                }
                else
                {
                    layer = characterManager.FindLayer(this.name);
                    if (layer != null)
                    {
                        layer.FadeOutAll(fadeTime);
                    }
                }
            }
        }
예제 #7
0
        //セーブデータ用のバイナリ読み込み
        void ReadSaveData(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= VERSION_1)
            {
                ReadOldVersion(reader, version);
            }
            else if (version == VERSION)
            {
                this.isEventMode = reader.ReadBoolean();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    string           name            = reader.ReadString();
                    string           layerName       = reader.ReadString();
                    string           graphicDataType = reader.ReadString();
                    string           graphicKey      = reader.ReadString();
                    bool             isDefault       = reader.ReadBoolean();
                    GraphicInfoList  graphicInfo     = AdvGraphicInfoParser.FindGraphicInfo(engine, graphicDataType, graphicKey);
                    AdvGraphicLayer  layer           = FindLayer(layerName);
                    AdvGraphicObject graphic         = layer.AddObject(name, graphicInfo, isDefault);
                    graphic.Read(graphicInfo, reader);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
예제 #8
0
        //キャラクターオブジェクトとして、特殊な表示をする
        internal AdvGraphicObject DrawCharacter(string layerName, string name, AdvGraphicOperaitonArg arg)
        {
            //既に同名のグラフィックがあるなら、そのレイヤーを取得
            AdvGraphicLayer oldLayer = null;

            foreach (var keyValue in layers)
            {
                if (keyValue.Value.IsEqualDefaultGraphicName(name))
                {
                    oldLayer = keyValue.Value;
                    break;
                }
            }

            //レイヤー名の指定がある場合、そのレイヤーを探す
            AdvGraphicLayer layer = FindLayer(layerName);

            if (layer == null)
            {
                //レイヤーがない場合は、旧レイヤーかデフォルトレイヤーを使う
                layer = (oldLayer == null) ? DefaultLayer : oldLayer;
            }

            //レイヤー変更があるか
            bool changeLayer = (oldLayer != layer && oldLayer != null);

            //レイヤー変更ないなら、描画しておわり
            if (!changeLayer)
            {
                //レイヤー上にデフォルトオブジェクトとして表示
                return(layer.DrawToDefault(name, arg));
            }

            Vector3    oldScale    = Vector3.one;
            Vector3    oldPosition = Vector3.zero;
            Quaternion oldRotation = Quaternion.identity;
            //レイヤーが変わる場合は、昔のほうを消す
            AdvGraphicObject oldObj;

            if (oldLayer.CurrentGraphics.TryGetValue(name, out oldObj))
            {
                oldScale    = oldObj.rectTransform.localScale;
                oldPosition = oldObj.rectTransform.localPosition;
                oldRotation = oldObj.rectTransform.localRotation;
                oldLayer.FadeOut(name, arg.GetSkippedFadeTime(manager.Engine));
            }

            //レイヤー上にデフォルトオブジェクトとして表示
            AdvGraphicObject obj = layer.DrawToDefault(name, arg);

            //ローカルTransform値を引き継ぐ処理
            if (!manager.ResetCharacterTransformOnChangeLayer)
            {
                obj.rectTransform.localScale    = oldScale;
                obj.rectTransform.localPosition = oldPosition;
                obj.rectTransform.localRotation = oldRotation;
            }
            return(obj);
        }
예제 #9
0
        //指定名のオブジェクトを非表示(フェードアウト)する
        internal virtual void FadeOut(string name, float fadeTime)
        {
            AdvGraphicLayer layer = FindLayerFromObjectName(name);

            if (layer != null)
            {
                layer.FadeOut(name, fadeTime);
            }
        }
예제 #10
0
 //指定のオブジェクトのレイヤー(キャンバス)をAdvEngineに埋め込み
 public void EmbedLayer(AdvGraphicLayer layer)
 {
     foreach (var keyValue in Groups)
     {
         if (keyValue.Value.Type == layer.LayerType)
         {
             keyValue.Value.EmbedLayer(layer);
         }
     }
 }
예제 #11
0
        //指定の名前のレイヤーを探す(見つからなかったらデフォルト)
        internal AdvGraphicLayer FindLayerOrDefault(string name)
        {
            AdvGraphicLayer layer = FindLayer(name);

            if (layer == null)
            {
                return(DefaultLayer);
            }
            return(layer);
        }
예제 #12
0
 internal void DestroyAll()
 {
     foreach (AdvGraphicLayer layer in layers)
     {
         layer.Clear();
         UtageToolKit.SafeDestroy(layer.gameObject);
     }
     layers.Clear();
     defaultLayer = null;
 }
예제 #13
0
 internal void DestroyAll()
 {
     foreach (AdvGraphicLayer layer in layers)
     {
         layer.Clear();
         GameObject.Destroy(layer.gameObject);
     }
     layers.Clear();
     DefaultLayer = null;
 }
예제 #14
0
 /// <summary>
 /// 指定のオブジェクト名のレイヤーを探す
 /// </summary>
 internal AdvGraphicLayer FindLayerByObjectName(string name)
 {
     foreach (var keyValue in Groups)
     {
         AdvGraphicLayer layer = keyValue.Value.FindLayerFromObjectName(name);
         if (layer != null)
         {
             return(layer);
         }
     }
     return(null);
 }
 internal AdvGraphicLayer FindLayer(string layerName)
 {
     foreach (KeyValuePair <AdvLayerSettingData.LayerType, AdvGraphicGroup> pair in this.Groups)
     {
         AdvGraphicLayer layer = pair.Value.FindLayer(layerName);
         if (layer != null)
         {
             return(layer);
         }
     }
     return(null);
 }
예제 #16
0
 /// <summary>
 /// 指定のキーのレイヤーを探す
 /// </summary>
 internal AdvGraphicLayer FindLayer(string layerName)
 {
     foreach (AdvGraphicGroup group in allGruop)
     {
         AdvGraphicLayer layer = group.FindLayer(layerName);
         if (layer != null)
         {
             return(layer);
         }
     }
     return(null);
 }
예제 #17
0
 //指定名グラフィックオブジェクトを持つか
 internal bool IsContians(string layerName, string name)
 {
     if (string.IsNullOrEmpty(layerName))
     {
         return(FindObject(name) != null);
     }
     else
     {
         AdvGraphicLayer layer = FindLayer(layerName);
         return(layer != null && layer.Find(name) != null);
     }
 }
예제 #18
0
 /// <summary>
 /// 指定のキーのレイヤーを探す
 /// </summary>
 internal AdvGraphicLayer FindLayer(string layerName)
 {
     foreach (var keyValue in Groups)
     {
         AdvGraphicLayer layer = keyValue.Value.FindLayer(layerName);
         if (layer != null)
         {
             return(layer);
         }
     }
     return(null);
 }
예제 #19
0
 void AddLayer(string name, AdvGraphicLayer layer)
 {
     if (layers.ContainsKey(name))
     {
         Debug.LogError(name + " is already exists in layers");
         return;
     }
     layers.Add(name, layer);
     if (layer.SettingData.IsDefault)
     {
         DefaultLayer = layer;
     }
 }
예제 #20
0
        public override void DoCommand(AdvEngine engine)
        {
            AdvGraphicLayer layer = engine.GraphicManager.FindLayer(this.name);

            if (layer != null)
            {
                layer.FadeOutAll(this.fadeTime);
            }
            else
            {
                Debug.LogError("Not found " + this.name + " Please input Layer name");
            }
        }
예제 #21
0
        public override void DoCommand(AdvEngine engine)
        {
            AdvGraphicLayer layer = engine.GraphicManager.FindLayer(this.name);

            if (layer != null)
            {
                layer.ResetCanvasRectTransform();
            }
            else
            {
                Debug.LogError("Not found " + this.name + " Please input Layer name");
            }
        }
예제 #22
0
        //指定のレイヤーを削除
        internal void RemoveLayer(AdvGraphicLayer layer)
        {
            string name = layer.gameObject.name;

            if (layers.ContainsKey(name))
            {
                layers.Remove(name);
            }
            else
            {
                Debug.LogError(name + " is not find");
            }
        }
		//起動時の初期化
		internal AdvGraphicGroup( AdvLayerSettingData.LayerType type, AdvLayerSetting setting, AdvGraphicManager manager )
		{
			this.type = type;
			foreach (var item in setting.List)
			{
				if (item.Type == type)
				{
					AdvGraphicLayer layer = UtageToolKit.AddChildGameObjectComponent<AdvGraphicLayer>(manager.transform, item.Name);
					layer.Init(manager,item);
					layers.Add(layer);
					if (item.IsDefault) defaultLayer = layer;
				}
			}
		}
예제 #24
0
        //指定のオブジェクトのレイヤー(キャンバス)をAdvEngineに埋め込み
        internal void EmbedLayer(AdvGraphicLayer layer)
        {
            layer.Init(manager);
            string name = layer.gameObject.name;

            if (layers.ContainsKey(name))
            {
                layers[name] = layer;
            }
            else
            {
                AddLayer(name, layer);
            }
        }
예제 #25
0
        public override void DoCommand(AdvEngine engine)
        {
            //オブジェクト名からレイヤーを探す
            AdvGraphicLayer layer = engine.GraphicManager.FindLayer(name);

            if (layer != null)
            {
                //消す
                layer.FadeOutAll(fadeTime);
            }
            else
            {
                Debug.LogError("Not found " + name + " Please input Layer name");
            }
        }
예제 #26
0
 internal void DestroyAll()
 {
     foreach (var keyValue in layers)
     {
         var layer = keyValue.Value;
         layer.Clear();
         //動的に作成したものだけ破壊
         if (layer is AdvGraphicLayerDefault)
         {
             GameObject.Destroy(keyValue.Value.gameObject);
         }
     }
     layers.Clear();
     DefaultLayer = null;
 }
예제 #27
0
        void ChangeOrder(AdvGraphicLayer layer, bool isLighting)
        {
            if (!EnableChangeOrder)
            {
                return;
            }
            int defaultOrder;

            if (!defaultOrders.TryGetValue(layer, out defaultOrder))
            {
                defaultOrder = layer.Canvas.sortingOrder;
                defaultOrders.Add(layer, layer.Canvas.sortingOrder);
            }
            layer.Canvas.sortingOrder = isLighting ? defaultOrder + orderOffset : defaultOrder;
        }
예제 #28
0
        public override void DoCommand(AdvEngine engine)
        {
            //オブジェクト名からレイヤーを探す
            AdvGraphicLayer layer = engine.GraphicManager.FindLayer(name);

            if (layer != null)
            {
                //リセットして初期状態に
                layer.ResetCanvasRectTransform();
            }
            else
            {
                Debug.LogError("Not found " + name + " Please input Layer name");
            }
        }
        internal GameObject FindObjectOrLayer(string name)
        {
            AdvGraphicObject obj2 = this.FindObject(name);

            if (obj2 != null)
            {
                return(obj2.get_gameObject());
            }
            AdvGraphicLayer layer = this.FindLayer(name);

            if (layer != null)
            {
                return(layer.get_gameObject());
            }
            return(null);
        }
예제 #30
0
        /// <summary>
        /// 指定の名前のレイヤーかグラフィックオブジェクトを検索
        /// </summary>
        internal GameObject FindObjectOrLayer(string name)
        {
            AdvGraphicObject obj = FindObject(name);

            if (obj != null)
            {
                return(obj.gameObject);
            }
            AdvGraphicLayer layer = FindLayer(name);

            if (layer != null)
            {
                return(layer.gameObject);
            }
            return(null);
        }
예제 #31
0
        //旧バージョン(LayerManagerだったころ)のデータ読み込み
        void ReadOldVersion(BinaryReader reader, int version)
        {
            if (version >= VERSION_1)
            {
                this.isEventMode = reader.ReadBoolean();
            }

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string          key   = reader.ReadString();
                AdvGraphicLayer layer = FindLayer(key);
                layer.ReadOld(reader);
            }
        }