protected virtual void InitTweenData() { string type = base.ParseCell <string>(AdvColumnName.Arg2); string arg = base.ParseCellOptional <string>(AdvColumnName.Arg3, string.Empty); string easeType = base.ParseCellOptional <string>(AdvColumnName.Arg4, string.Empty); string loopType = base.ParseCellOptional <string>(AdvColumnName.Arg5, string.Empty); this.tweenData = new iTweenData(type, arg, easeType, loopType); }
public AdvEffectDataTween(StringGridRow row) { this.targetName = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1); this.targetType = TargetType.Default; string type = AdvParser.ParseCell<string>(row, AdvColumnName.Arg2); string arg = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg3, ""); string easeType = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg4, ""); string loopType = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg5, ""); this.waitType = AdvParser.ParseCellOptional<WaitType>(row, AdvColumnName.Arg6, WaitType.Wait); this.tweenData = new iTweenData(type, arg, easeType, loopType); if (this.tweenData.Type == iTweenType.Stop) { waitType = WaitType.Add; } if (!string.IsNullOrEmpty(tweenData.ErrorMsg)) { Debug.LogError(row.ToErrorString(tweenData.ErrorMsg)); } }
public AdvEffectDataTween(AdvCommand command) { this.targetName = command.ParseCell <string>(AdvColumnName.Arg1); this.targetType = TargetType.Default; string type = command.ParseCell <string>(AdvColumnName.Arg2); string arg = command.ParseCellOptional <string>(AdvColumnName.Arg3, ""); string easeType = command.ParseCellOptional <string>(AdvColumnName.Arg4, ""); string loopType = command.ParseCellOptional <string>(AdvColumnName.Arg5, ""); this.waitType = command.ParseCellOptional <WaitType>(AdvColumnName.Arg6, WaitType.Wait); this.tweenData = new iTweenData(type, arg, easeType, loopType); if (this.tweenData.Type == iTweenType.Stop) { waitType = WaitType.Add; } if (!string.IsNullOrEmpty(tweenData.ErrorMsg)) { Debug.LogError(command.ToErrorString(tweenData.ErrorMsg)); } }
/// <summary> /// 初期化 /// </summary> /// <param name="type">Tweenのデータ</param> /// <param name="hashObjects">Tweenのパラメーター</param> /// <param name="loopCount">ループ回数</param> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="skipSpeed">スキップ中の演出速度の倍率。0ならスキップなし</param> /// <param name="callbackComplete">終了時に呼ばれるコールバック</param> public void Init(iTweenData data, float pixelsToUnits, float skipSpeed, Action <AdvTweenPlayer> callbackComplete) { this.data = data; if (data.Type == iTweenType.Stop) { return; } this.callbackComplete = callbackComplete; data.ReInit(); hashTbl = iTween.Hash(data.HashObjects.ToArray()); //2D座標にあわせる if (iTweenData.IsPostionType(data.Type)) { if (hashTbl.ContainsKey("x")) { hashTbl["x"] = (float)hashTbl["x"] / pixelsToUnits; } if (hashTbl.ContainsKey("y")) { hashTbl["y"] = (float)hashTbl["y"] / pixelsToUnits; } if (hashTbl.ContainsKey("z")) { hashTbl["z"] = (float)hashTbl["z"] / pixelsToUnits; } } //スキップ中なら演出時間を調整 if (skipSpeed > 0) { bool isSpeed = hashTbl.ContainsKey("speed"); if (isSpeed) { hashTbl["speed"] = (float)hashTbl["speed"] * skipSpeed; } bool isTime = hashTbl.ContainsKey("time"); if (isTime) { hashTbl["time"] = (float)hashTbl["time"] / skipSpeed; } else if (!isSpeed) { hashTbl["time"] = 1.0f / skipSpeed; } } //カラーの処理を2D仕様に if (data.Type == iTweenType.ColorTo || data.Type == iTweenType.ColorFrom) { this.graphicObject = this.gameObject.GetComponent <AdvGraphicObject>(); if (graphicObject != null) { Color currentColor = graphicObject.EffectColors.GetColor(EffectColors.Index.TweenColor); if (data.Type == iTweenType.ColorTo) { hashTbl["from"] = currentColor; hashTbl["to"] = ParaseTargetColor(hashTbl, currentColor); } else if (data.Type == iTweenType.ColorFrom) { hashTbl["from"] = ParaseTargetColor(hashTbl, currentColor); hashTbl["to"] = currentColor; } hashTbl["onupdate"] = "OnColorUpdate"; isColorSprite = true; } } //終了時に呼ばれるメッセージを登録 hashTbl["oncomplete"] = "OnComplete"; hashTbl["oncompletetarget"] = this.gameObject; hashTbl["oncompleteparams"] = this; //停止処理用に名前を設定 tweenName = this.GetHashCode().ToString(); hashTbl["name"] = tweenName; }
/// <summary> /// セーブデータ用のバイナリ読みこみ /// </summary> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="reader">バイナリリーダー</param> public void Read(BinaryReader reader, float pixelsToUnits) { iTweenData data = new iTweenData(reader); Init(data, pixelsToUnits, 1.0f, null); }
/// <summary> /// 初期化 /// </summary> /// <param name="type">Tweenのデータ</param> /// <param name="hashObjects">Tweenのパラメーター</param> /// <param name="loopCount">ループ回数</param> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="skipSpeed">スキップ中の演出速度の倍率。0ならスキップなし</param> /// <param name="callbackComplete">終了時に呼ばれるコールバック</param> public void Init(iTweenData data, bool isUnder2DSpace, float pixelsToUnits, float skipSpeed, bool unscaled, Action <AdvITweenPlayer> callbackComplete) { this.data = data; if (data.Type == iTweenType.Stop) { return; } this.callbackComplete = callbackComplete; data.ReInit(); hashTbl = iTween.Hash(data.MakeHashArray()); if (iTweenData.IsPostionType(data.Type)) { //座標系の処理は、基本的に2D座標の値で入力されているので、 //非ローカルの場合や、2D座標じゃない場合は、pixelsToUnitsで3D座標値に変換する if (!isUnder2DSpace || (!hashTbl.ContainsKey("islocal") || (bool)hashTbl["islocal"] == false)) { if (hashTbl.ContainsKey("x")) { hashTbl["x"] = (float)hashTbl["x"] / pixelsToUnits; } if (hashTbl.ContainsKey("y")) { hashTbl["y"] = (float)hashTbl["y"] / pixelsToUnits; } if (hashTbl.ContainsKey("z")) { hashTbl["z"] = (float)hashTbl["z"] / pixelsToUnits; } } } //スキップ中なら演出時間を調整 if (skipSpeed > 0) { bool isSpeed = hashTbl.ContainsKey("speed"); if (isSpeed) { hashTbl["speed"] = (float)hashTbl["speed"] * skipSpeed; } bool isTime = hashTbl.ContainsKey("time"); if (isTime) { hashTbl["time"] = (float)hashTbl["time"] / skipSpeed; } else if (!isSpeed) { hashTbl["time"] = 1.0f / skipSpeed; } } //カラーの処理を2D仕様に if (data.Type == iTweenType.ColorTo || data.Type == iTweenType.ColorFrom) { this.target = this.gameObject.GetComponent <AdvEffectColor>(); if (target != null) { Color currentColor = target.TweenColor; if (data.Type == iTweenType.ColorTo) { hashTbl["from"] = currentColor; hashTbl["to"] = ParaseTargetColor(hashTbl, currentColor); } else if (data.Type == iTweenType.ColorFrom) { hashTbl["from"] = ParaseTargetColor(hashTbl, currentColor); hashTbl["to"] = currentColor; } hashTbl["onupdate"] = "OnColorUpdate"; isColorSprite = true; } } //時間をタイムスケールに比例させない if (unscaled) { hashTbl["ignoretimescale"] = true; } //終了時に呼ばれるメッセージを登録 hashTbl["oncomplete"] = "OnCompleteTween"; hashTbl["oncompletetarget"] = this.gameObject; hashTbl["oncompleteparams"] = this; //停止処理用に名前を設定 tweenName = this.GetHashCode().ToString(); hashTbl["name"] = tweenName; }
/// <summary> /// セーブデータ用のバイナリ読みこみ /// </summary> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="reader">バイナリリーダー</param> public void Read(BinaryReader reader, bool isUnder2DSpace, float pixelsToUnits, bool unscaled) { iTweenData data = new iTweenData(reader); Init(data, isUnder2DSpace, pixelsToUnits, 1.0f, unscaled, null); }
/// <summary> /// 初期化 /// </summary> /// <param name="type">Tweenのデータ</param> /// <param name="hashObjects">Tweenのパラメーター</param> /// <param name="loopCount">ループ回数</param> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="skipSpeed">スキップ中の演出速度の倍率。0ならスキップなし</param> /// <param name="callbackComplete">終了時に呼ばれるコールバック</param> public void Init(iTweenData data, float pixelsToUnits, float skipSpeed, Action<AdvTweenPlayer> callbackComplete) { this.data = data; if (data.Type == iTweenType.Stop) return; this.callbackComplete = callbackComplete; data.ReInit(); hashTbl = iTween.Hash(data.HashObjects.ToArray()); //2D座標にあわせる if (iTweenData.IsPostionType(data.Type)) { if (hashTbl.ContainsKey("x")) hashTbl["x"] = (float)hashTbl["x"] / pixelsToUnits; if (hashTbl.ContainsKey("y")) hashTbl["y"] = (float)hashTbl["y"] / pixelsToUnits; if (hashTbl.ContainsKey("z")) hashTbl["z"] = (float)hashTbl["z"] / pixelsToUnits; } //スキップ中なら演出時間を調整 if (skipSpeed > 0) { bool isSpeed = hashTbl.ContainsKey("speed"); if (isSpeed) hashTbl["speed"] = (float)hashTbl["speed"] * skipSpeed; bool isTime = hashTbl.ContainsKey("time"); if(isTime) { hashTbl["time"] = (float)hashTbl["time"]/ skipSpeed; } else if(!isSpeed) { hashTbl["time"] = 1.0f / skipSpeed; } } //カラーの処理を2D仕様に if (data.Type == iTweenType.ColorTo || data.Type == iTweenType.ColorFrom) { this.graphicObject = this.gameObject.GetComponent<AdvGraphicObject>(); if (graphicObject != null) { Color currentColor = graphicObject.EffectColors.GetColor(EffectColors.Index.TweenColor); if (data.Type == iTweenType.ColorTo) { hashTbl["from"] = currentColor; hashTbl["to"] = ParaseTargetColor(hashTbl, currentColor); } else if (data.Type == iTweenType.ColorFrom) { hashTbl["from"] = ParaseTargetColor(hashTbl, currentColor); hashTbl["to"] = currentColor; } hashTbl["onupdate"] = "OnColorUpdate"; isColorSprite = true; } } //終了時に呼ばれるメッセージを登録 hashTbl["oncomplete"] = "OnComplete"; hashTbl["oncompletetarget"] = this.gameObject; hashTbl["oncompleteparams"] = this; //停止処理用に名前を設定 tweenName = this.GetHashCode().ToString(); hashTbl["name"] = tweenName; }
public void Init(iTweenData data, bool isUnder2DSpace, float pixelsToUnits, float skipSpeed, Action <AdvITweenPlayer> callbackComplete) { this.data = data; if (data.Type != iTweenType.Stop) { this.callbackComplete = callbackComplete; data.ReInit(); this.hashTbl = iTween.Hash(data.MakeHashArray()); if (iTweenData.IsPostionType(data.Type) && ((!isUnder2DSpace || !this.hashTbl.ContainsKey("islocal")) || !((bool)this.hashTbl["islocal"]))) { if (this.hashTbl.ContainsKey("x")) { this.hashTbl["x"] = ((float)this.hashTbl["x"]) / pixelsToUnits; } if (this.hashTbl.ContainsKey("y")) { this.hashTbl["y"] = ((float)this.hashTbl["y"]) / pixelsToUnits; } if (this.hashTbl.ContainsKey("z")) { this.hashTbl["z"] = ((float)this.hashTbl["z"]) / pixelsToUnits; } } if (skipSpeed > 0f) { bool flag = this.hashTbl.ContainsKey("speed"); if (flag) { this.hashTbl["speed"] = ((float)this.hashTbl["speed"]) * skipSpeed; } if (this.hashTbl.ContainsKey("time")) { this.hashTbl["time"] = ((float)this.hashTbl["time"]) / skipSpeed; } else if (!flag) { this.hashTbl["time"] = 1f / skipSpeed; } } if ((data.Type == iTweenType.ColorTo) || (data.Type == iTweenType.ColorFrom)) { this.target = base.get_gameObject().GetComponent <AdvEffectColor>(); if (this.target != null) { Color tweenColor = this.target.TweenColor; if (data.Type == iTweenType.ColorTo) { this.hashTbl["from"] = tweenColor; this.hashTbl["to"] = this.ParaseTargetColor(this.hashTbl, tweenColor); } else if (data.Type == iTweenType.ColorFrom) { this.hashTbl["from"] = this.ParaseTargetColor(this.hashTbl, tweenColor); this.hashTbl["to"] = tweenColor; } this.hashTbl["onupdate"] = "OnColorUpdate"; this.isColorSprite = true; } } this.hashTbl["oncomplete"] = "OnCompleteTween"; this.hashTbl["oncompletetarget"] = base.get_gameObject(); this.hashTbl["oncompleteparams"] = this; this.tweenName = this.GetHashCode().ToString(); this.hashTbl["name"] = this.tweenName; } }
public void Read(BinaryReader reader, bool isUnder2DSpace, float pixelsToUnits) { iTweenData data = new iTweenData(reader); this.Init(data, isUnder2DSpace, pixelsToUnits, 1f, null); }