示例#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;
	}
示例#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);
    }
示例#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;
	}
示例#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);
        }
    }
示例#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;
	}