Exemplo n.º 1
0
	static Example.MapEntityEvent ExportMapEntityEvent(MapEventTrigger[] eventTriggers,int targetId,Example.MapEntityEvent.Type targetType){ 
		var entityEvent = new Example.MapEntityEvent ();

		var actionTriggers = new List<Example.MapActionTrigger>();
		foreach (var eventTrigger in eventTriggers) { 	
			var trigger = new Example.MapActionTrigger ();  
			trigger.EventType = (Example.MapActionTrigger.Type)eventTrigger.eventType;

			var condition = eventTrigger.Condition;
			var value =  new Example.ContentValue ();
			value.IntValue = condition.intValue;
			value.StrValue = condition.strValue;
			value.FloatValue = condition.floatValue;
			value.Vector3Value = MapUtil.ToVector3f(condition.posValue);  
			trigger.Value = value;

			trigger.Actions = ExportMapEventActions (eventTrigger.GetComponentsInChildren<MapEventAction> (), trigger.Id.ToString ());
			if (eventTrigger.triggerEvent != null) {
				trigger.TriggerEventId = eventTrigger.triggerEvent.eventId;
			}
			actionTriggers.Add (trigger);
		}
		entityEvent.Triggers = actionTriggers;
		entityEvent.TargetId = targetId;
		entityEvent.TargetType = targetType; 

		return entityEvent;
	}
Exemplo n.º 2
0
    private static List <Example.ContentValue> ArrayToList(ContentValue[] array)
    {
        List <Example.ContentValue> list = new List <Example.ContentValue> ();

        foreach (var element in array)
        {
            Example.ContentValue value = new Example.ContentValue();
            value.IntValue     = element.IntValue;
            value.FloatValue   = element.FloatValue;
            value.StrValue     = element.StrValue;
            value.Vector3Value = MathUtil.ToVector3f(element.Vector3Value);
            list.Add(value);
        }
        return(list);
    }
Exemplo n.º 3
0
	static Example.MapEventAction ExportMapEventAction(MapEventAction mapAction){

		var args = new List<Example.ContentValue> ();
		foreach (var mapActionArg in mapAction.Argments) { 
			var value =  new Example.ContentValue ();
			value.IntValue = mapActionArg.intValue;
			value.StrValue = mapActionArg.strValue;
			value.FloatValue = mapActionArg.floatValue;
			value.Vector3Value = MapUtil.ToVector3f(mapActionArg.posValue); 
			args.Add (value);
		}

		Example.MapEventAction action = new Example.MapEventAction ();  
		action.ActionType = (Example.MapEventAction.Type)mapAction.actionType;
		action.Target = mapAction.actionTarget;
		action.Args = args;
		action.DelayTime = mapAction.delayTime;

		return action;
	}
Exemplo n.º 4
0
    private static void PrintArgment(GameObject go, Example.ContentValue arg)
    {
        if (arg.IntValue != 0)
        {
            MapEventHelper.AddChildGameObject(go, "intValue-" + arg.IntValue);
        }

        if (arg.FloatValue != 0)
        {
            MapEventHelper.AddChildGameObject(go, "floatValue-" + arg.FloatValue);
        }

        if (!string.IsNullOrEmpty(arg.StrValue))
        {
            MapEventHelper.AddChildGameObject(go, "strValue-" + arg.StrValue);
        }
        var pos = MapUtil.Vector3fToVector3(arg.Vector3Value);

        if (pos.magnitude > 0)
        {
            MapEventHelper.AddChildGameObject(go, "vecValue-" + pos);
        }
    }
Exemplo n.º 5
0
	static Example.MapEvent ExportMapEvent(List<Example.MapEvent> events,MapEvent sceneEvent){

		Example.MapEvent mapEvent = new Example.MapEvent (); 
		mapEvent.EventType = (int)sceneEvent.eventType;  

		List<Example.MapEventCondition> conditions = new List<Example.MapEventCondition> (); 
		foreach (var condition in sceneEvent.Conditions) {
			Example.MapEventCondition cond = new Example.MapEventCondition ();

			var value =  new Example.ContentValue ();
			value.IntValue = condition.intValue;
			value.StrValue = condition.strValue;
			value.FloatValue = condition.floatValue;
			value.Vector3Value = MapUtil.ToVector3f(condition.posValue); 

			cond.Arg2 = value;
			conditions.Add (cond);
		}

		List<Example.MapEventAction> actions = new List<Example.MapEventAction> ();

		var mapActions = sceneEvent.GetComponentsInChildren<MapEventAction> ();
		foreach (var mapAction in mapActions) {
			var action = ExportMapEventAction (mapAction);
			actions.Add (action);
		}
		mapEvent.ExecuteCount = sceneEvent.executeCount;
		mapEvent.Interception = sceneEvent.interception;
		mapEvent.Conditions = conditions;
		mapEvent.Actions = actions;
		events.Add (mapEvent);
		mapEvent.Id = events.Count;
		sceneEvent.eventId = mapEvent.Id;

		return mapEvent;
	}