78 lines
2.1 KiB
C#
78 lines
2.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
using GCGame.Table;
|
|
|
|
public class MissionRewFloatItem : MonoBehaviour {
|
|
|
|
public Image _itemIcon;
|
|
public Image _itemQuality;
|
|
|
|
public float _moveTime = 1.0f;
|
|
|
|
private int _rewDataId;
|
|
public void InitItem(int dataId)
|
|
{
|
|
this.gameObject.SetActive(true);
|
|
_rewDataId = dataId;
|
|
var commonItem = TableManager.GetCommonItemByID(dataId, 0);
|
|
if(commonItem == null)
|
|
{
|
|
gameObject.SetActive(false);
|
|
gameObject.transform.SetParent(null);
|
|
GameObject.Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
LoadAssetBundle.Instance.SetImageSprite(_itemIcon, commonItem.Icon, delegate(bool isSucess, GameObject obj) {
|
|
LoadAssetBundle.Instance.SetImageSprite(_itemQuality, GCGame.Utils.GetItemQualityFrame(commonItem.Quality));
|
|
});
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, _itemIcon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, _itemIcon.transform);
|
|
}
|
|
|
|
StartMove();
|
|
}
|
|
|
|
private void StartMove()
|
|
{
|
|
Hashtable args = new Hashtable();
|
|
|
|
args.Add("easeType", iTween.EaseType.easeOutQuad);
|
|
args.Add("time", 1.0f);
|
|
args.Add("looptype", "none");
|
|
args.Add("islocal", false);
|
|
|
|
if(FunctionButtonLogic.Instance())
|
|
{
|
|
args.Add("position", FunctionExLogic.Instance()._backTransform.position);
|
|
//args.Add("x", FunctionExLogic.Instance()._backTransform.position.x);
|
|
//args.Add("y", FunctionExLogic.Instance()._backTransform.position.y);
|
|
}
|
|
|
|
args.Add("oncomplete", "MoveOver");
|
|
|
|
iTween.MoveTo(this.gameObject, args);
|
|
}
|
|
|
|
public void MoveOver()
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
iTween.Stop(this.gameObject);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
gameObject.SetActive(false);
|
|
iTween.Stop(this.gameObject);
|
|
}
|
|
|
|
}
|