Beispiel #1
0
 public void OnEffectEventRaised(EffectEventType eType)
 {
     if (null != EventRaised)
     {
         (new Logger()).WriteDebug4("shared:effect:event:" + eType.ToString() + ":before [hc:" + GetHashCode() + "]");
         try
         {
             EventRaised(eType, this);
         }
         catch (System.Net.Sockets.SocketException)
         {
             (new Logger()).WriteDebug4("shared:effect:client:lost:dispose:before [hc:" + GetHashCode() + "]");
             if (EffectEventType.stopped != eType)
             {
                 Stop();
             }
             Dispose();
             (new Logger()).WriteDebug4("shared:effect:client:lost:dispose:after [hc:" + GetHashCode() + "]");
         }
         catch (Exception ex)
         {
             (new Logger()).WriteError(ex);
         }
         (new Logger()).WriteDebug4("shared:effect:event:" + eType.ToString() + ":after [hc:" + GetHashCode() + "]");
     }
     else
     {
         (new Logger()).WriteDebug4("shared:effect:event:" + eType.ToString() + ":empty [hc:" + GetHashCode() + "]");
     }
 }
Beispiel #2
0
 public Color GetValue( EffectEventType _type )
 {
     for ( int i = 0; i < propInfos.Count; ++i ) {
         PropInfo propInfo = propInfos[i];
         if ( propInfo.type == _type )
             return propInfo.val;
     }
     return normal;
 }
Beispiel #3
0
 public Color GetValue(EffectEventType _type)
 {
     for (int i = 0; i < propInfos.Count; ++i)
     {
         PropInfo propInfo = propInfos[i];
         if (propInfo.type == _type)
         {
             return(propInfo.val);
         }
     }
     return(normal);
 }
Beispiel #4
0
    private Sprite GetSpriteForEventType(EffectEventType type)
    {
        switch (type)
        {
        case EffectEventType.Normal:
            return(normalEventSprite);

        case EffectEventType.LongTerm:
            return(longTermEventSprite);

        case EffectEventType.God:
            return(godEventSprite);
        }
        return(normalEventSprite);
    }
Beispiel #5
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddEffect_Offset(exSpriteBase _target, EffectEventType _type, exEase.Type _curveType, Vector2 _to, float _duration)
    {
        exUIControl ctrl = GetComponent <exUIControl>();

        if (ctrl)
        {
            EffectInfo_Offset info = new EffectInfo_Offset();
            info.duration  = _duration;
            info.target    = _target;
            info.normal    = _target.offset;
            info.curveType = _curveType;

            EffectInfo_Offset.PropInfo propInfo = new EffectInfo_Offset.PropInfo();
            propInfo.type = _type;
            propInfo.val  = _to;
            info.propInfos.Add(propInfo);

            EffectState_Offset state = new EffectState_Offset();
            state.info = info;
            state.func = info.GetCurveFunction();
            AddState_Offset(ctrl, state);
        }
    }
Beispiel #6
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void AddEffect_Scale(Transform _target, EffectEventType _type, exEase.Type _curveType, Vector3 _to, float _duration)
    {
        exUIControl ctrl = GetComponent <exUIControl>();

        if (ctrl)
        {
            EffectInfo_Scale info = new EffectInfo_Scale();
            info.duration  = _duration;
            info.target    = _target;
            info.normal    = _target.localScale;
            info.curveType = _curveType;

            EffectInfo_Scale.PropInfo propInfo = new EffectInfo_Scale.PropInfo();
            propInfo.type = _type;
            propInfo.val  = _to;
            info.propInfos.Add(propInfo);

            EffectState_Scale state = new EffectState_Scale();
            state.info = info;
            state.func = info.GetCurveFunction();
            AddState_Scale(ctrl, state);
        }
    }
Beispiel #7
0
		public void OnEffectEventRaised(EffectEventType eType)
		{
			if (null != EventRaised)
			{
				(new Logger()).WriteDebug4("shared:effect:event:" + eType.ToString() + ":before [hc:" + GetHashCode() + "]");
				try
				{
					EventRaised(eType, this);
				}
				catch (System.Net.Sockets.SocketException)
				{
					(new Logger()).WriteDebug4("shared:effect:client:lost:dispose:before [hc:" + GetHashCode() + "]");
					if (EffectEventType.stopped != eType)
						Stop();
					Dispose();
					(new Logger()).WriteDebug4("shared:effect:client:lost:dispose:after [hc:" + GetHashCode() + "]");
				}
				catch (Exception ex)
				{
					(new Logger()).WriteError(ex);
				}
				(new Logger()).WriteDebug4("shared:effect:event:" + eType.ToString() + ":after [hc:" + GetHashCode() + "]");
			}
			else
				(new Logger()).WriteDebug4("shared:effect:event:" + eType.ToString() + ":empty [hc:" + GetHashCode() + "]");
		}
Beispiel #8
0
		protected abstract void CallbackTransport(EffectEventType eType, shared.Effect cEffect);
Beispiel #9
0
		public void Callback(EffectEventType eType, shared.Effect cEffect)
		{
			CallbackTransport(eType, cEffect);
		}
Beispiel #10
0
 private void AddEventMessage(string _message, EffectEventType _type)
 {
     eventMessages.Add(new EventMessage {
         message = _message, type = _type
     });
 }
Beispiel #11
0
    private void ApplyEffect(CardData.CardEffectChance effect, string defaultStartText, EffectEventType type)
    {
        string message = "";

        if (effect != null)
        {
            Villagers += effect.villagerChange;
            Goats     += effect.goatChange;
            Maidens   += effect.maidenChange;
            YoungLads += effect.youngLadChange;
            deck.AddToDeck(effect.unlockedCards);
            if (defaultStartText != null && defaultStartText != "")
            {
                message += defaultStartText + System.Environment.NewLine;
            }
            message += CardData.GetEffectText(effect) + System.Environment.NewLine;
        }
        else
        {
            if (defaultStartText != null && defaultStartText != "")
            {
                message = defaultStartText;
            }
            else
            {
                message = "Nothing Happened";
            }
        }
        AddEventMessage(message, type);
    }
Beispiel #12
0
 protected abstract void CallbackTransport(EffectEventType eType, shared.Effect cEffect);
Beispiel #13
0
 public void Callback(EffectEventType eType, shared.Effect cEffect)
 {
     CallbackTransport(eType, cEffect);
 }
Beispiel #14
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    public void AddEffect_Scale( Transform _target, EffectEventType _type, exEase.Type _curveType, Vector3 _to, float _duration )
    {
        exUIControl ctrl = GetComponent<exUIControl>();
        if ( ctrl ) {
            EffectInfo_Scale info = new EffectInfo_Scale();
            info.duration = _duration;
            info.target = _target;
            info.normal = _target.localScale;
            info.curveType = _curveType;

            EffectInfo_Scale.PropInfo propInfo = new EffectInfo_Scale.PropInfo();
            propInfo.type = _type;
            propInfo.val = _to;
            info.propInfos.Add(propInfo);

            EffectState_Scale state = new EffectState_Scale();
            state.info = info;
            state.func = info.GetCurveFunction();
            AddState_Scale( ctrl, state );
        }
    }
Beispiel #15
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    public void AddEffect_Offset( exSpriteBase _target, EffectEventType _type, exEase.Type _curveType, Vector2 _to, float _duration )
    {
        exUIControl ctrl = GetComponent<exUIControl>();
        if ( ctrl ) {
            EffectInfo_Offset info = new EffectInfo_Offset();
            info.duration = _duration;
            info.target = _target;
            info.normal = _target.offset;
            info.curveType = _curveType;

            EffectInfo_Offset.PropInfo propInfo = new EffectInfo_Offset.PropInfo();
            propInfo.type = _type;
            propInfo.val = _to;
            info.propInfos.Add(propInfo);

            EffectState_Offset state = new EffectState_Offset();
            state.info = info;
            state.func = info.GetCurveFunction();
            AddState_Offset( ctrl, state );
        }
    }