//オブジェクトを描画する internal AdvGraphicObject Draw(string name, AdvGraphicOperaitonArg arg) { AdvGraphicObject obj = GetObjectCreateIfMissing(name, arg); obj.Draw(arg); return(obj); }
//キャラクター表示更新 public override void DoCommand(AdvEngine engine) { if (this.characterInfo.IsHide) { //表示オフの指定なので、表示キャラフェードアウト engine.GraphicManager.CharacterManager.FadeOut(characterInfo.Label, engine.Page.ToSkippedTime(fadeTime)); } else if (CheckDrawCharacter(engine)) { //グラフィック表示処理 engine.GraphicManager.CharacterManager.DrawCharacter( layerName , characterInfo.Label , new AdvGraphicOperaitonArg(this, this.characterInfo.Graphic.Main, fadeTime)); } if (CheckNewCharacterInfo(engine)) { //現在のページのキャラクター情報は上書き engine.Page.CharacterInfo = characterInfo; } //基本以外のコマンド引数の適用 AdvGraphicObject obj = engine.GraphicManager.CharacterManager.FindObject(this.characterInfo.Label); if (obj != null) { //位置の適用(Arg4とArg5) obj.SetCommandPostion(this); //その他の適用(モーション名など) obj.TargetObject.SetCommandArg(this); } }
public override void DoCommand(AdvEngine engine) { AdvGraphicOperaitonArg graphicOperaitonArg = new AdvGraphicOperaitonArg(this, graphic.Main, fadeTime); engine.GraphicManager.IsEventMode = false; //表示する if (string.IsNullOrEmpty(layerName)) { engine.GraphicManager.BgManager.DrawToDefault(engine.GraphicManager.BgSpriteName, graphicOperaitonArg); } else { engine.GraphicManager.BgManager.Draw(layerName, engine.GraphicManager.BgSpriteName, graphicOperaitonArg); } //基本以外のコマンド引数の適用 AdvGraphicObject obj = engine.GraphicManager.BgManager.FindObject(engine.GraphicManager.BgSpriteName); if (obj != null) { //位置の適用(Arg4とArg5) obj.SetCommandPostion(this); //その他の適用(モーション名など) obj.TargetObject.SetCommandArg(this); } }
//初期化処理 public override void Init(AdvGraphicObject parentObject) { base.Init(parentObject); //3Dモデルは自分のほうを向く this.transform.localEulerAngles = Vector3.up * 180; }
//セーブデータ用のバイナリ読み込み public virtual void Read(BinaryReader reader) { int version = reader.ReadInt32(); if (version < 0 || version > Version) { Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version)); return; } reader.ReadLocalTransform(this.transform); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { string key = reader.ReadString(); AdvGraphicInfo graphic = null; reader.ReadBuffer(x => graphic = AdvGraphicInfo.ReadGraphicInfo(Engine, x)); byte[] buffer = reader.ReadBuffer(); AdvGraphicObject obj = CreateObject(key, graphic, false); obj.Read(buffer, graphic); } string defaulObjectName = reader.ReadString(); DefaultObject = Find(defaulObjectName); }
//セーブデータ用のバイナリ読み込み 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)); } }
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); } } }
//RenderTextureの一部を表示 protected virtual void SetIconRenderTexture(Rect rect) { AdvGraphicObject obj = targetObject; if (obj.RenderTextureSpace == null) { return; } RawImage rawImage = ChangeIconComponent <RawImage>(); if (obj.RenderTextureSpace.RenderTextureType == AdvRenderTextureMode.Image) { rawImage.material = new Material(ShaderManager.DrawByRenderTexture); } Texture texture = obj.RenderTextureSpace.RenderTexture; rawImage.texture = texture; float w = texture.width; float h = texture.height; Transform t = obj.TargetObject.transform; // RectTransform rectTransform = obj.TargetObject.transform as RectTransform; // Rect clipRect = new Rect( w/2+ imageRect.xMin, h/2-imageRect.yMax, imageRect.width, imageRect.height); float scaleX = t.localScale.x; float scaleY = t.localScale.y; rect.position = new Vector2(rect.position.x * scaleX, rect.position.y * scaleY); rect.size = new Vector2(rect.size.x * scaleX, rect.size.y * scaleY); // clipRect = new Rect(clipRect.xMin + rect.xMin, clipRect.yMin + rect.yMin, rect.width, rect.height); rawImage.uvRect = rect.ToUvRect(w, h); }
public override void DoCommand(AdvEngine engine) { string layer = layerName; if (string.IsNullOrEmpty(layer)) { //レイヤー名指定なしならスプライトのデフォルトレイヤー layer = engine.GraphicManager.SpriteManager.DefaultLayer.name; } //表示する engine.GraphicManager.DrawObject(layer, label, graphicOperaitonArg); // AdvGraphicObjectParticle particle = obj.TargetObject as AdvGraphicObjectParticle; // particle.AddSortingOrder(sortingOrder,""); //基本以外のコマンド引数の適用 AdvGraphicObject obj = engine.GraphicManager.FindObject(label); if (obj != null) { //位置の適用(Arg4とArg5) obj.SetCommandPostion(this); //その他の適用(モーション名など) obj.TargetObject.SetCommandArg(this); } }
//旧バージョン(LayerManagerだったころ)のレイヤーデータ読み込み internal void ReadOld(BinaryReader reader) { //Transofom,Colorを空読み込み Vector3 pos = new Vector3(); Vector3 euler = new Vector3(); Vector3 scale = new Vector3(); UtageToolKit.ReadLocalTransform(reader, out pos, out euler, out scale); UtageToolKit.ReadColor(reader); //Tween情報を空読み込み int tweenCount = reader.ReadInt32(); for (int i = 0; i < tweenCount; ++i) { AdvTweenPlayer tween = this.gameObject.AddComponent <AdvTweenPlayer>() as AdvTweenPlayer; tween.Read(reader, Manager.PixelsToUnits); Destroy(tween); } //各スプライトの読み込み int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { string name = reader.ReadString(); GameObject go = UtageToolKit.AddChildGameObject(this.transform, name); AdvGraphicObject2DSprite obj = go.AddComponent <AdvGraphicObject2DSprite>(); obj.Init(this); currentGraphics.Add(name, obj); obj.ReadOld(reader); } //デフォルトオブジェクトを設定 defaultObject = Find(reader.ReadString()); }
//キャラクターオブジェクトとして、特殊な表示をする 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); }
//テキストに変更があった場合 protected virtual void OnChangeText(AdvPage page) { if (!TyrSetIcon(page)) { targetObject = null; HideIcon(); } }
private void OnChangeText(AdvPage page) { if (!this.TyrSetIcon(page)) { this.targetObject = null; this.HideIcon(); } }
public override void Init(AdvGraphicObject parentObject) { base.Init(parentObject); this.AddGraphicComponentOnInit(); if (base.GetComponent <IAdvClickEvent>() == null) { base.get_gameObject().AddComponent <AdvClickEvent>(); } }
internal void FadeOutAll(float fadeTime) { foreach (var obj in currentGraphics.Values) { obj.FadeOut(fadeTime); } currentGraphics.Clear(); defaultObject = null; }
/// <summary> /// クリックイベントを追加 /// </summary> internal void RemoveClickEvent(string name) { AdvGraphicObject obj = FindObject(name); if (obj != null) { obj.RemoveClickEvent(); } }
//(古いバージョンのデータを読み込むときに使う) internal void SetDefault(string defualtSpriteName) { AdvGraphicObject obj = Find(defualtSpriteName); if (obj != null) { defaultObject = obj; } }
IEnumerator CoDelayOut(AdvGraphicObject obj, float delay) { yield return(new WaitForSeconds(delay)); if (obj != null) { obj.Clear(); } }
//クリア処理 internal void Clear() { foreach (var obj in currentGraphics.Values) { obj.Clear(); } currentGraphics.Clear(); defaultObject = null; }
//オブジェクトを描画する internal AdvGraphicObject Draw(string name, AdvGraphicOperaitonArg arg) { AdvGraphicObject obj = GetObjectCreateIfMissing(name, arg.Graphic); obj.Loader.LoadGraphic(arg.Graphic, () => { obj.Draw(arg, arg.GetSkippedFadeTime(Engine)); }); return(obj); }
//パーティクルを探索する public AdvGraphicObject FindParticle(string targetName) { AdvGraphicObject obj = Find(targetName); if (obj != null && obj.TargetObject is AdvGraphicObjectParticle) { return(obj); } return(null); }
/* * //RectTransformにレイヤー情報を設定 * internal void SetToRectTransform(RectTransform rectTransform, float defaultWitdh, float defaultHeight, float pixelsToUnits) * { * float x, width; * Horizontal.GetBorderdPositionAndSize(defaultWitdh, out x, out width); * float y, height; * Vertical.GetBorderdPositionAndSize(defaultHeight, out y, out height); * * rectTransform.localPosition = new Vector3(x, y, Z) / pixelsToUnits; * rectTransform.SetSize(width, height); * rectTransform.localScale = Scale / pixelsToUnits; * }*/ internal void Remove(AdvGraphicObject obj) { if (currentGraphics.ContainsValue(obj)) { currentGraphics.Remove(obj.name); } if (DefaultObject == obj) { DefaultObject = null; } }
void FadOutParticle(AdvGraphicObject obj, AdvParticleStopType stopType) { AdvGraphicObjectParticle particle = obj.TargetObject as AdvGraphicObjectParticle; if (particle != null) { particle.Stop(stopType); fadeOutingObjets.Add(obj); Remove(obj); } }
//デフォルトオブジェクトとして描画する internal AdvGraphicObject DrawToDefault(string name, AdvGraphicOperaitonArg arg) { //デフォルトオブジェクトの名前が違うなら、そのオブジェクトを消す if (DefaultObject != null && DefaultObject.name != name) { //フェードアウトする FadeOut(DefaultObject.name, arg.FadeTime); } defaultObject = GetObjectCreateIfMissing(name, arg); defaultObject.Draw(arg); return(defaultObject); }
/// <summary> /// 指定の名前のグラフィックオブジェクトを検索 /// </summary> internal AdvGraphicObject FindObject(string name) { foreach (var keyValue in Groups) { AdvGraphicObject obj = keyValue.Value.FindObject(name); if (obj != null) { return(obj); } } return(null); }
public AdvGraphicObject FindFadeOutingObject(string name) { foreach (var keyValue in layers) { AdvGraphicObject obj = keyValue.Value.FindFadeOutingObject(name); if (obj != null) { return(obj); } } return(null); }
/// <summary> /// 指定の名前のグラフィックオブジェクトを検索 /// </summary> internal AdvGraphicObject FindObject(string name) { foreach (AdvGraphicGroup group in allGruop) { AdvGraphicObject obj = group.FindObject(name); if (obj != null) { return(obj); } } return(null); }
//カラーを取得 void ChangeColor(AdvGraphicObject obj, Color color) { if (FadeTime > 0) { Color from = obj.EffectColors.GetColor(EffectColors.Index.Color1); StartCoroutine(FadeColor(obj, from, color)); } else { obj.EffectColors.SetColor(EffectColors.Index.Color1, color); } }
//指定の名前のグラフィックオブジェクトをを探す internal AdvGraphicObject FindObject(string name) { foreach (AdvGraphicLayer layer in layers) { AdvGraphicObject obj = layer.Find(name); if (obj != null) { return(obj); } } return(null); }
internal AdvGraphicObject FindObject(string name) { foreach (KeyValuePair <AdvLayerSettingData.LayerType, AdvGraphicGroup> pair in this.Groups) { AdvGraphicObject obj2 = pair.Value.FindObject(name); if (obj2 != null) { return(obj2); } } return(null); }