// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-09-28 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using System.Collections; using System.Collections.Generic; using UnityEngine; namespace G { /// /// /// public class ActionExecutor { public static void Execute(TutorialAction action) { //按钮 if (action.type == 1) { if (!string.IsNullOrEmpty(action.button)) { var data = UI.GuideWindow.Empty; data.targetPath = action.button; data.delay = action.delay; if (action.talkings != null) { if (action.talkings.Length > 0) { data.talking = KLocalization.GetLocalString(action.talkings[0]); } if (action.talkings.Length > 2) { data.talkingPoint = new Vector2(action.talkings[1], action.talkings[2]); } if (action.talkings.Length > 4) { data.talkingAnchor = new Vector2(action.talkings[3] * 0.1f, action.talkings[4] * 0.1f); } } if (action.hands != null && action.hands.Length >= 2) { data.handPoint = new Vector2(action.hands[0], action.hands[1]); data.handAnimId = 0; if (action.hands.Length >= 3) { data.handAnimId = action.hands[2]; } data.handTips = null; if (action.hands.Length >= 4) { data.handTips = KLocalization.GetLocalString(action.hands[3]); } } KUIWindow.OpenWindow(data); if (action.pause) { Time.timeScale = 0f; action.userData = "pause"; } } } else if (action.type == 7) { var data = UI.GuideWindow.Empty; data.targetPath = null; data.delay = action.delay; if (action.talkings != null) { if (action.talkings.Length > 0) data.talking = KLocalization.GetLocalString(action.talkings[0]); if (action.talkings.Length > 2) { data.talkingPoint = new Vector2(action.talkings[1], action.talkings[2]); } } if (action.hands != null && action.hands.Length >= 2) { data.handPoint = new Vector2(action.hands[0], action.hands[1]); data.handAnimId = 0; if (action.hands.Length >= 3) { data.handAnimId = action.hands[2]; } data.handTips = null; if (action.hands.Length >= 4) { data.handTips = KLocalization.GetLocalString(action.hands[3]); } } KUIWindow.OpenWindow(data); if (action.pause) { Time.timeScale = 0f; action.userData = "pause"; } } else if (action.type == 3) { var textId = action.talkings[0]; var text = KLocalization.GetLocalString(textId); UI_Ingame.Instance.ShowBubble(text, action.duration, action.delay); } else if (action.type == 4) { //var itemId = action.typeArgs[0]; //UI.RewardWindow.ShowItem("获得神器", "一把屠龙刀 要不要试一试", itemId, 1, (error) => // { // var equipments = ItemProxy.Instance.GetEquipments(); // foreach (var equipment in equipments) // { // if (equipment.itemId == itemId) // { // PlayerProxy.Instance.SetEquipment(equipment); // return; // } // } // }); } else if (action.type == 5) { if (GameLevel.Instance) { var textId = action.talkings[0]; var text = KLocalization.GetLocalString(textId); GameLevel.Instance.SetGroundText(text, action.duration, action.delay); } } } public static void Finish(TutorialAction action) { if (action.type == 1 || action.type == 7) { if ((action.userData as string) == "pause") { Time.timeScale = 1f; action.userData = null; } } } } }