private static Transform SetNormalStage(int knifes, float speed, int minKnifes = 1, int maxKnifes = 4, int apples = 1, bool bonus = false, float fireSpeed = 0.05f, float knifeSpeed = 1) { UIObjects uIObjects = UIObjects.objectsUI; Image bg = uIObjects.Background.GetComponent <Image>(); bg.sprite = uIObjects.NormalFon; Settings.settings.KnifeSpeed = knifeSpeed; Settings.settings.FireRate = fireSpeed; UIObjects.objectsUI.BossAnoun.gameObject.SetActive(false); Rotate.TimeBetweenWhilling = Settings.settings.WheelingTime * 50; Settings.Knifes = knifes; Rotate.RotatingSpeed = speed; Transform wheel = WheelAndBosses.wheelAndBosses.Wheel(); RandomKnifesAndApple.Spawning(minKnifes, maxKnifes, apples); if (bonus) { Fire.fire.BonusLevel(); } else { Fire.fire.InstKnife(); } return(wheel); }
/// <summary> /// Delete the object named key from existence. /// </summary> public static void DeleteObject(string key) { if (!Objects.ContainsKey(key)) { return; } GameObject del = (CollidableObject)Objects[key]; if (CollidableObjects.Contains(del)) { CollidableObjects.Remove((CollidableObject)del); } if (UIObjects.Contains(del)) { UIObjects.Remove((UIObject)del); } if (NonUIObjects.Contains(del)) { NonUIObjects.Remove(del); } if (Backgrounds.Contains(del)) { Backgrounds.Remove((Background)(del)); } Objects.Remove(key); }
/// <summary> /// Adds a GameObject reference to the Objects dictionary /// If a CollidableObject is passed, it is also added to the CollidableObjects List /// </summary> /// <param name="name">GameObject name</param> /// <param name="g">GameObject reference</param> public static void Add(string name, GameObject g) { Objects.Add(name, g); if (g is CollidableObject) { CollidableObject c = (CollidableObject)g; CollidableObjects.Add(c); NonUIObjects.Add(g); } else if (g is Background) { Background b = (Background)g; Backgrounds.Add(b); } else if (g is UIObject) { UIObject ui = (UIObject)g; UIObjects.Add(ui); } else if (g is SFXWrapper) { SFXWrapper wrap = (SFXWrapper)g; SoundEffects.Add(wrap); } else { NonUIObjects.Add(g); } }
protected override void OnLoadComplete() { _UITopbar = new ObjectUI(0, 0, 0, 90, new DrawUIFrame(Color.Wheat, Color.DarkSlateBlue, 1, 0)); _UIInfo = new ObjectUIPlayerInfo(DirectionType.TopLeft, 5, 5, MoveNull.Value); _UIInfo.Click += (x, e) => { PlayerInfoShow(); }; _UISceneChoice = new ObjectUISceneChoice(0, 90, Width, Height - _UITopbar.Layout.Height); _UISceneChoice.SceneChoice += (x, i, l) => { GlobalScenes.ChoiceScene = i; GlobalScenes.ChoiceLevel = l; OnGoScene(new SceneSkill()); }; _UISceneChoice.SceneHightScoreClick += (x, i, l) => { HightScoreShow(i); }; _UISceneChoice.Mode = GlobalScenes.ChoiceScene == null ? 0 : 1; UIObjects.Add(_UITopbar); UIObjects.Add(_UISceneChoice); UIObjects.Add(_UIInfo); if (string.IsNullOrWhiteSpace(GlobalPlayer.PlayerName)) { PlayerInfoShow(); } base.OnLoadComplete(); }
public SceneGaming() { SceneTimeFix = 1.4F; MenuCooldownCounter = new CounterObject(Sec(2)); EndDelay = new CounterObject(Global.DefaultEndDelayLimit); IntervalOfWave = Global.DefaultIntervalOfWave; WaveNo = new CounterObject(0); Waves = new List <WaveLine>(); WaveEvents = new Dictionary <string, WaveEventHandle>(); _UIPlayName = new ObjectUI(75, 20, 150, 25, new DrawUIText(Color.Black, Color.WhiteSmoke, Color.Empty, Color.Empty, 0, 0, GlobalPlayer.PlayerName, new Font("微軟正黑體", 11), GlobalFormat.MiddleLeft)); _UIEnergyBar = new ObjectUI(80, 45, 150, 15, new DrawUICounterBar(GlobalColors.EnergyBar, Color.Black, Color.AliceBlue, 2, false)); _UISkillIcon1 = new ObjectUI(250, 10, 50, 50, _DrawSkill1); _UISkillIcon2 = new ObjectUI(320, 10, 50, 50, _DrawSkill2); Skill1 = GlobalScenes.ChoiceSkill1; Skill2 = GlobalScenes.ChoiceSkill2; UIObjects.Add(_UISkillIcon1); UIObjects.Add(_UISkillIcon2); UIObjects.Add(_UIPlayName); UIObjects.Add(_UIEnergyBar); GameObjects.ObjectDead += OnObjectDead; ShowMenu = false; }
private void CheckForExportedThemeFolderThenBuild(UIObjects targetUI) { string uiName = Enum.GetName(typeof(UIObjects), targetUI); if (!AssetDatabase.IsValidFolder("Assets/ExportedThemes")) { AssetDatabase.CreateFolder("Assets", "ExportedThemes"); Debug.Log("Created export folder for themes!"); } if (!AssetDatabase.IsValidFolder($"Assets/ExportedThemes/{uiName}")) { AssetDatabase.CreateFolder("Assets/ExportedThemes", uiName); Debug.Log($"Create export folder for {uiName}"); } if (!AssetDatabase.IsValidFolder($"Assets/ExportedThemes/{uiName}/{ThemeName}")) { AssetDatabase.CreateFolder($"Assets/ExportedThemes/{uiName}", ThemeName); Debug.Log($"Created export folder for theme: {ThemeName}"); } string fullPathToTheme = $"{Application.dataPath}/ExportedThemes/{uiName}/{ThemeName}"; AssetBundleExporter.CreateExportAssetbundle(fullPathToTheme, targetUI, ThemeCreator); }
void Awake() { if (instance == null) { instance = this; } audioS = GetComponent <AudioSource>(); }
public override void Draw(Graphics g) { if (Visible) { Propertys.AllDoBeforeDraw(g); DrawObject.Draw(g, Layout.Rectangle); BackObjects.AllDrawSelf(g); UIObjects.AllDrawSelf(g); Propertys.AllDoAfterDraw(g); } }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Debug.Log("Instance already exists, destroying object!"); Destroy(this); } }
private void Awake() { //Singleton code if (Instance != null && Instance != this) { Debug.LogError("Trying to instantiate a second singleton", gameObject); } else { Instance = this; } }
public void selectObject(UIObjects obj) { gameObject.SetActive(true); transform.parent.Find("EmptyDescription").gameObject.SetActive(false); transform.Find("Name").GetComponent<Text>().text = obj.objectName; transform.Find("Description").GetComponent<Text>().text = obj.description; if (selected != null) selected.SetActive(false); selected = transform.Find("Objects/" + obj.transform.parent.name).gameObject; selected.SetActive(true); checkBought(obj); }
public void setObject(UIObjects obj) { if (!obj.isCollector) gameObject.SetActive(true); selectedObj = obj; objName = obj.transform.parent.name; category = obj.transform.parent.parent.name; limit = objectsMenu.Find(category + "Button").GetComponent<ObjectsCategoryButton>().selectionLimit; if (limitReached()) { filter.sharedMesh = inactiveMesh; } else { filter.sharedMesh = activeMesh; } }
private bool disposedValue = false; // 偵測多餘的呼叫 protected override void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { EffectObjects.Clear(); GameObjects.Clear(); UIObjects.Clear(); RoundTimer.Enabled = false; RoundTimer.Dispose(); } disposedValue = true; } base.Dispose(disposing); }
/// <summary> /// 回合動作 /// </summary> protected virtual void Round() { OnBeforeRound(); EffectObjects.AllDoBeforeRound(); GameObjects.AllAction(); EffectObjects.AllDoAfterRound(); OnAfterRound(); UIObjects.AllAction(); EffectObjects.AllSettlement(); GameObjects.ClearAllDead(); UIObjects.ClearAllDead(); EffectObjects.ClearAllDisabled(); Drawing(); }
void OnEnable() { toggles = new bool[] { false, false, false, false, false, false }; buttons = new string[] { "Open", "Open", "Open", "Open", "Open" }; vars = (managerVars)AssetDatabase.LoadAssetAtPath("Assets/AlienHop/Resources/managerVarsContainer.asset", typeof(managerVars)); book = Resources.Load("question", typeof(Texture2D)) as Texture2D; GDbanner = Resources.Load("GDbanner", typeof(Texture2D)) as Texture2D; try{ gameUI = GameObject.FindGameObjectWithTag("GameUI"); UIO = gameUI.GetComponent <UIObjects> (); }catch (Exception e) {} try{ liveUpdate(); }catch (Exception e) {} }
public void HightScoreShow(ISceneInfo sceneInfo) { if (_UIHightScore != null) { return; } LockScene(Color.FromArgb(100, 0, 0, 0), 3); _UIHightScore = new ObjectUIHighScore(DirectionType.Center, 5, 5, MoveNull.Value, sceneInfo); _UIHightScore.Close += (x, e) => { HightScoreHide(); }; _UIHightScore.Layout.X = Width / 2; _UIHightScore.Layout.Y = Height / 2; UIObjects.Add(_UIHightScore); }
public override void OnInspectorGUI() { TargetWindow = (UIObjects)EditorGUILayout.EnumPopup("UI To Theme", TargetWindow); ThemeCreator.ThemePreviewMaterial = (Material)EditorGUILayout.ObjectField("Theme Material", ThemeCreator.ThemePreviewMaterial, typeof(Material), false); ThemeName = EditorGUILayout.TextField("Theme Name", ThemeName); if (ThemeCreator.ThemePreviewMaterial == null) { EditorGUILayout.HelpBox("Please assign a preview material with a UI Shader of your choosing!", MessageType.Error); } string uiName = Enum.GetName(typeof(UIObjects), TargetWindow); switch (TargetWindow) { case UIObjects.WristBackground: if (ThemeCreator.ThemePreviewImg != null && ThemeCreator.ThemePreviewMaterial != null) { DrawButtons(); } break; case UIObjects.SettingsBackground: EditorGUILayout.HelpBox($"{uiName} cannot be themed currently, but is PLANNED for future releases!", MessageType.Error); break; case UIObjects.GlobalToolbarBackground: EditorGUILayout.HelpBox($"{uiName} cannot be themed currently, but is PLANNED for future releases!", MessageType.Error); break; case UIObjects.WindowToolbarBackground: EditorGUILayout.HelpBox($"{uiName} cannot be themed currently, but is PLANNED for future releases!", MessageType.Error); break; case UIObjects.KeyboardBackground: EditorGUILayout.HelpBox($"{uiName} cannot be themed currently, but is PLANNED for future releases!", MessageType.Error); break; } if (InvalidName) { EditorGUILayout.HelpBox("Please name your theme, and try again!", MessageType.Error); } EditorGUILayout.HelpBox("NOTE: Themes cannot currently move UI elements. The default user icon is only there to help you with alignment.", MessageType.Info); }
/// <summary> /// 繪製畫面 /// </summary> protected void Drawing() { BufferGraphics.Clear(Color.White); OnBeforeDraw(BufferGraphics); EffectObjects.AllDoBeforeDraw(BufferGraphics); EffectObjects.AllDoBeforeDrawFloor(BufferGraphics); OnDrawFloor(BufferGraphics); EffectObjects.AllDoBeforeDrawObject(BufferGraphics); GameObjects.AllDrawSelf(BufferGraphics); OnBeforeDrawUI(BufferGraphics); EffectObjects.AllDoBeforeDrawUI(BufferGraphics); UIObjects.AllDrawSelf(BufferGraphics); OnAfterDrawUI(BufferGraphics); EffectObjects.AllDoAfterDraw(BufferGraphics); OnAfterDrawReset(BufferGraphics); OnAfterDraw(BufferGraphics); ThisGraphics.DrawImageUnscaled(BufferImage, 0, 0); }
public void PlayerInfoShow() { if (_UIPlayerNameSetting != null) { return; } LockScene(Color.FromArgb(100, 0, 0, 0), 3); _UIPlayerNameSetting = new ObjectUINameSetting(DirectionType.Center, 5, 5, new MoveStraight(null, 1, 800, 1, 100, 1F)); _UIPlayerNameSetting.Close += (x, e) => { PlayerInfoHide(); }; _UIPlayerNameSetting.Layout.X = Width / 2; _UIPlayerNameSetting.Layout.Y = Height / 2 - 100; _UIPlayerNameSetting.MoveObject.Target.SetObject(new PointObject(_UIPlayerNameSetting.Layout.X, Height / 2)); UIObjects.Add(_UIPlayerNameSetting); }
public static void CreateExportAssetbundle(string outputPath, UIObjects targetUI, XSOverlayThemeCreator themeCreator) { string newName = "placeholder"; string oldName = themeCreator.ThemePreviewMaterial.name; switch (targetUI) { case UIObjects.WristBackground: newName = "WristBackground"; break; case UIObjects.SettingsBackground: newName = "SettingsBackground"; break; case UIObjects.GlobalToolbarBackground: newName = "GlobalToolbarBackground"; break; case UIObjects.WindowToolbarBackground: newName = "WindowToolbarBackground"; break; case UIObjects.KeyboardBackground: newName = "KeyboardBackground"; break; } string pathToMaterial = AssetDatabase.GetAssetPath(themeCreator.ThemePreviewMaterial); AssetDatabase.RenameAsset(pathToMaterial, newName); AssetBundleBuild[] buildMap = new AssetBundleBuild[1]; buildMap[0].assetBundleName = AssetBundleName; string[] materialAssets = new string[1]; materialAssets[0] = pathToMaterial; buildMap[0].assetNames = materialAssets; BuildPipeline.BuildAssetBundles(outputPath, buildMap, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows); themeCreator.ThemePreviewMaterial.name = oldName; AssetDatabase.RenameAsset(pathToMaterial, oldName); AssetDatabase.Refresh(); }
void OnEnable() { toggles = new bool[] { false, false, false }; buttons = new string[] { "Open", "Open", "Open" }; vars = (ManageVariables)AssetDatabase.LoadAssetAtPath("Assets/Game/Resources/ManageVariablesContainer.asset", typeof(ManageVariables)); book = Resources.Load("question", typeof(Texture2D)) as Texture2D; GDbanner = Resources.Load("GDbanner", typeof(Texture2D)) as Texture2D; try { UIO = Camera.main.GetComponent <UIObjects>(); } catch (Exception e) { } try { liveUpdate(); } catch (Exception e) { } }
public void setObject(UIObjects obj) { gameObject.SetActive(true); selectedObj = obj; objectName = obj.transform.parent.name; price = obj.getPrice(which); priceText.text = price.ToString("N0"); icon.adjust(priceText); if (cubes.youHave() < price) { affordable = false; priceText.color = notAffordableTextColor; stopBlink(); } else { affordable = true; priceText.color = new Color(255, 255, 255); if (which == "normal") { startBlink(); } } }
public static void ScriptReferences() //Assigns script references { systemListConstructor = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <SystemListConstructor>(); cameraFunctionsScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraFunctions>(); turnInfoScript = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <TurnInfo>(); playerTurnScript = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <PlayerTurn>(); diplomacyScript = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <DiplomacyControlScript>(); systemGUI = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <SystemGUI>(); heroGUI = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <HeroGUI>(); racialTraitScript = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <RacialTraits> (); galaxyGUI = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <GalaxyGUI>(); invasionGUI = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <InvasionGUI> (); mapConstructor = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <MapConstructor> (); winConditions = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <WinConditions> (); systemFunctions = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <SystemFunctions> (); systemInvasion = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <SystemInvasions> (); uiObjects = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <UIObjects> (); ambientStarRandomiser = GameObject.FindGameObjectWithTag("ScriptContainer").GetComponent <AmbientStarRandomiser> (); voronoiGenerator = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <VoronoiGeneratorAndDelaunay> (); heroResource = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <HeroResourceImprovement> (); systemPopup = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <SystemInfoPopup> (); triangulation = GameObject.FindGameObjectWithTag("GUIContainer").GetComponent <Triangulation> (); }
/// <summary> /// 回合事件 /// </summary> protected override void Round() { UIObjects.ClearAllDead(); OnBeforeRound(); if (IsStart) { EffectObjects.AllDoBeforeRound(); GameObjects.AllAction(); EffectObjects.AllDoAfterRound(); } OnAfterRound(); if (IsStart) { EffectObjects.AllSettlement(); } UIObjects.AllAction(); GameObjects.ClearAllDead(); UIObjects.ClearAllDead(); EffectObjects.ClearAllDisabled(); if (IsStart) { // 結束時停止波數增加但不立即停止遊戲 if (IsEnding) { if (EndDelay.IsFull) { //Cursor.Show(); ShowMenu = true; IsEnding = false; IsStart = false; } else { EndDelay.Value += IntervalOfRound; } } else if (!WaveNo.IsFull) { if (WaveCounter.IsFull) { WaveCounter.Value = 0; WaveNo.Value++; GoWave(WaveNo.Value); } WaveCounter.Value += SceneIntervalOfRound; } if (!MenuCooldownCounter.IsFull) { MenuCooldownCounter.Value += IntervalOfRound; } } Drawing(); }
private void Start() { uiObjects = GetComponent <UIObjects>(); }
public void checkBought(UIObjects obj) { int level = DataManager.dm.getInt(selected.name + "Level"); objLevel.text = "LV " + level.ToString(); objLevel.transform.Find("Percent").gameObject.SetActive(false); Text upgradeLevel = upgradeInfo.transform.Find("Level").GetComponent<Text>(); Text upgradeLabel = upgradeInfo.transform.Find("Label").GetComponent<Text>(); if (level == 0) { rotate = false; objLevel.gameObject.SetActive(false); upgradeInfo.SetActive(false); selectButton.SetActive(false); unselectButton.SetActive(false); } else { objLevel.gameObject.SetActive(true); upgradeInfo.SetActive(true); upgradeInfo.transform.Find("Description").GetComponent<Text>().text = obj.upgradeEffect; SmallObjects smallObject = obj.transform.parent.Find("Object").GetComponent<SmallObjects>(); smallObject.checkBought(); smallObject.changeDetail(selected); if (!obj.isCollector) { selectButton.SetActive(true); unselectButton.SetActive(true); } if (obj.isActive()) { rotate = true; selectButton.SetActive(false); if (selected.transform.Find("Effect") != null) selected.transform.Find("Effect").gameObject.SetActive(true); unselectButton.GetComponent<ObjectUnselectButton>().setObject(obj); } else { rotate = false; selectButton.GetComponent<ObjectSelectButton>().setObject(obj); if (selected.transform.Find("Effect") != null) selected.transform.Find("Effect").gameObject.SetActive(false); unselectButton.SetActive(false); } } if (level >= obj.maxLevel) { upgradeLevel.text = "MAX"; upgradeLabel.text = "upgrade end"; buyButtonByCube.SetActive(false); buyButtonByGoldencube.SetActive(false); } else { upgradeLevel.text = "LV " + (level + 1).ToString(); upgradeLabel.text = "upgrade"; buyButtonByCube.SetActive(true); buyButtonByGoldencube.SetActive(true); buyButtonByCube.GetComponent<ObjectBuyButton>().setObject(obj); buyButtonByGoldencube.GetComponent<ObjectBuyButton>().setObject(obj); } if (obj.isCollector) { rotate = true; } if (obj.isGoldOnly) { buyButtonByCube.SetActive(false); buyButtonByGoldencube.GetComponent<RectTransform>().anchoredPosition = new Vector2(oneButtonOnlyPosition, buyButtonByGoldencube.GetComponent<RectTransform>().anchoredPosition.y); if (level > 0) { objLevel.text = "cube\n+50%%"; objLevel.transform.Find("Percent").gameObject.SetActive(true); buyButtonByGoldencube.SetActive(false); upgradeInfo.SetActive(false); } } else if (obj.isCubeOnly) { buyButtonByGoldencube.SetActive(false); buyButtonByCube.GetComponent<RectTransform>().anchoredPosition = new Vector2(oneButtonOnlyPosition, buyButtonByCube.GetComponent<RectTransform>().anchoredPosition.y); objLevel.text = "LV " + (level - 1) + "\n+" + (level - 1) * 5 + "%%"; objLevel.transform.Find("Percent").gameObject.SetActive(true); upgradeLevel.text = "LV " + level.ToString(); } else { buyButtonByCube.GetComponent<RectTransform>().anchoredPosition = new Vector2(cubeOriginalPosition, buyButtonByCube.GetComponent<RectTransform>().anchoredPosition.y); buyButtonByGoldencube.GetComponent<RectTransform>().anchoredPosition = new Vector2(goldOriginalPosition, buyButtonByGoldencube.GetComponent<RectTransform>().anchoredPosition.y); } }
public ObjectUIGameMenu(DirectionType anchor, int x, int y, MoveBase moveObject, ScenePlayingInfo playingInfo, int mode) : base(anchor, x, y, 380, 240 + playingInfo.ScoreDetail.Count * _DetailHeight, new DrawUIFrame(Color.Empty, Color.DarkSlateBlue, 2, 20), moveObject) { _DrawCommandAction = new DrawUIText(Color.Black, Color.White, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "", Global.CommandFont, GlobalFormat.MiddleCenter); _DrawCommandActionHover = new DrawUIText(Color.Black, Color.White, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "", Global.CommandFont, GlobalFormat.MiddleCenter); _UICommandAction = new ObjectUI(210, Layout.Height - 75, 150, 50, _DrawCommandAction); _UICommandAction.DrawObjectHover = _DrawCommandActionHover; _UICommandAction.Layout.Depend.SetObject(this); _UICommandAction.Layout.Depend.Anchor = DirectionType.TopLeft; _UICommandAction.Propertys.Add(new PropertyShadow(-4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandAction.Click += (s, e) => { OnActionButtonClick(_ActionCommand); }; _DrawCommandBack = new DrawUIText(Color.Black, Color.White, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "回選單", Global.CommandFont, GlobalFormat.MiddleCenter); _DrawCommandBackHover = new DrawUIText(Color.Black, Color.White, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "回選單", Global.CommandFont, GlobalFormat.MiddleCenter); _UICommandBack = new ObjectUI(20, Layout.Height - 75, 150, 50, _DrawCommandBack); _UICommandBack.DrawObjectHover = _DrawCommandBackHover; _UICommandBack.Layout.Depend.SetObject(this); _UICommandBack.Layout.Depend.Anchor = DirectionType.TopLeft; _UICommandBack.Propertys.Add(new PropertyShadow(4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandBack.Click += (s, e) => { OnBackButtonClick(); }; _DrawCommandUpdate = new DrawUIText(Color.Black, Color.White, Color.FromArgb(150, 225, 255, 225), Color.Black, 2, 10, "上傳分數", _UpdateFont, GlobalFormat.MiddleCenter); _DrawCommandUpdateHover = new DrawUIText(Color.Black, Color.White, Color.FromArgb(200, 255, 235, 220), Color.Black, 2, 10, "上傳分數", _UpdateFont, GlobalFormat.MiddleCenter); _UICommandUpdate = new ObjectUI(270, 10, 90, 25, _DrawCommandUpdate); _UICommandUpdate.DrawObjectHover = _DrawCommandUpdateHover; _UICommandUpdate.Layout.Depend.SetObject(this); _UICommandUpdate.Layout.Depend.Anchor = DirectionType.TopLeft; _UICommandUpdate.Propertys.Add(new PropertyShadow(4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandUpdate.Click += (s, e) => { if (Global.Online) { Global.SQL.AddParameter("@SceneID", PlayingInfo.SceneID); Global.SQL.AddParameter("@Level", PlayingInfo.Level); Global.SQL.AddParameter("@PlayerName", GlobalPlayer.PlayerName); Global.SQL.AddParameter("@Score", PlayingInfo.Score); if (Global.SQL.Run(@"set time_zone = '+8:00'; insert into Score (SceneID,Level,PlayerName,Score,UpdateTime) values (@SceneID,@Level,@PlayerName,@Score,now())")) { _DrawCommandUpdate.Text = "上傳成功"; _DrawCommandUpdateHover.Text = "上傳成功"; _UICommandUpdate.Enabled = false; } else { _DrawCommandUpdate.Text = "上傳失敗"; _DrawCommandUpdateHover.Text = "上傳失敗"; } } else { _DrawCommandUpdate.Text = "不可用"; _DrawCommandUpdateHover.Text = "不可用"; _UICommandUpdate.Enabled = false; } }; UIObjects.Add(_UICommandBack); UIObjects.Add(_UICommandAction); UIObjects.Add(_UICommandUpdate); PlayingInfo = playingInfo; Mode = mode; }
public ObjectUIHighScore(DirectionType anchor, int x, int y, MoveBase moveObject, ISceneInfo sceneInfo) : base(anchor, x, y, 380, 390, new DrawUIFrame(Color.AliceBlue, Color.CornflowerBlue, 2, 20), moveObject) { Propertys.Add(new PropertyShadow(0, 6, 0.95F, 1)); DrawUIText drawCommandClose = new DrawUIText(Color.RoyalBlue, Color.Gray, Color.FromArgb(175, 220, 230, 255), Color.FromArgb(100, 140, 255), 1, 10, "關 閉", new Font("微軟正黑體", 14), GlobalFormat.MiddleCenter); DrawUIText drawCommandCloseHover = new DrawUIText(Color.RoyalBlue, Color.Gray, Color.FromArgb(220, 255, 250, 235), Color.FromArgb(100, 140, 255), 1, 10, "關 閉", new Font("微軟正黑體", 14), GlobalFormat.MiddleCenter); _CommandClose = new ObjectUI(285, 10, 75, 30, drawCommandClose) { DrawObjectHover = drawCommandCloseHover }; _CommandClose.Propertys.Add(new PropertyShadow(2, 2) { RFix = -0.5F, GFix = -0.5F, BFix = -0.5F, Opacity = 0.2F }); _CommandClose.Layout.Depend.Anchor = DirectionType.TopLeft; _CommandClose.Layout.Depend.SetObject(this); _CommandClose.Click += (s, e) => { OnClose(); }; UIObjects.Add(_CommandClose); if (sceneInfo == null) { return; } _SceneInfo = sceneInfo; int itemWidth = 40; int itemHeight = 25; int left = 15; int top = 15; _SceneButtons = new ObjectUI[sceneInfo.MaxLevel]; for (int i = 0; i < sceneInfo.MaxLevel; i++) { int idx = i + 1; DrawUIFrame drawObject = new DrawUIFrame(Color.FromArgb(175, 255, 255, 255), Color.FromArgb(100, 140, 255), 1, 8) { Scale = 0.8F }; ObjectUI newObject = new ObjectUI(left, top, itemWidth, itemHeight, drawObject); newObject.Layout.Depend.SetObject(this); newObject.Layout.Depend.Anchor = DirectionType.TopLeft; newObject.Propertys.Add(new PropertyShadow(3, 3) { Opacity = 0.2F, ScaleX = 0.95F, ScaleY = 0.95F }); UIObjects.Add(newObject); left += itemWidth; drawObject.AfterDraw += (s, g, r) => { g.DrawString(idx.ToString(), _ItemFont, Brushes.RoyalBlue, r, GlobalFormat.MiddleCenter); }; newObject.GetFocus += (s, e) => { (s as ObjectUI).DrawObject.Colors.SetColor("Border", Color.Red); _HoverLevel = idx; }; newObject.LostFocus += (s, e) => { (s as ObjectUI).DrawObject.Colors.SetColor("Border", Color.FromArgb(100, 140, 255)); _HoverLevel = 0; }; newObject.Click += (s, e) => { SelectedIndex = _HoverLevel; }; _SceneButtons[i] = newObject; } SelectedIndex = 1; DrawUIFrame drawPanel = new DrawUIFrame(Color.FromArgb(180, 220, 240, 250), Color.Empty, 0, 0); ObjectUI panel = new ObjectUI(10, 50, Layout.Width - 20, Layout.Height - 60, drawPanel); panel.Propertys.Add(new PropertyShadow(-2, -2)); panel.Layout.Depend.SetObject(this); panel.Layout.Depend.Anchor = DirectionType.Left | DirectionType.Top; UIObjects.Add(panel); _DrawRects = new DrawUIText[3, 10]; _DrawInfos = new string[3, 10]; int rectLeft = 5, rectTop = 5; int rectHeight = 27; for (int i = 0; i < 10; i++) { _DrawRects[0, i] = new DrawUIText(Color.RoyalBlue, Color.Empty, Color.AliceBlue, Color.Empty, 0, 0, "", _ItemFont2, GlobalFormat.MiddleCenter); _DrawRects[1, i] = new DrawUIText(Color.RoyalBlue, Color.Empty, Color.WhiteSmoke, Color.Empty, 0, 0, "", _ItemFont2, GlobalFormat.MiddleLeft); _DrawRects[2, i] = new DrawUIText(Color.RoyalBlue, Color.Empty, Color.WhiteSmoke, Color.Empty, 0, 0, "", _ItemFont2, GlobalFormat.MiddleRight); ObjectUI object1 = new ObjectUI(rectLeft, rectTop, 35, rectHeight, _DrawRects[0, i]); ObjectUI object2 = new ObjectUI(rectLeft + 40, rectTop, 210, rectHeight, _DrawRects[1, i]); ObjectUI object3 = new ObjectUI(rectLeft + 255, rectTop, 90, rectHeight, _DrawRects[2, i]); object1.Propertys.Add(new PropertyShadow(2, 2)); object2.Propertys.Add(new PropertyShadow(2, 2)); object3.Propertys.Add(new PropertyShadow(2, 2)); object1.Layout.Depend.SetObject(panel); object2.Layout.Depend.SetObject(panel); object3.Layout.Depend.SetObject(panel); object1.Layout.Depend.Anchor = DirectionType.Left | DirectionType.Top; object2.Layout.Depend.Anchor = DirectionType.Left | DirectionType.Top; object3.Layout.Depend.Anchor = DirectionType.Left | DirectionType.Top; UIObjects.Add(object1); UIObjects.Add(object2); UIObjects.Add(object3); rectTop += rectHeight + 5; } _DrawCommandMessage = new DrawUIText(Color.Red, Color.Gray, Color.LightYellow, Color.Black, 1, 0, "連線中...", new Font("微軟正黑體", 20), GlobalFormat.MiddleCenter); _CommandMessage = new ObjectUI(DirectionType.Center, 0, 0, 200, 60, _DrawCommandMessage); _CommandMessage.Layout.Depend.SetObject(this); _CommandMessage.Layout.Depend.Anchor = DirectionType.Center; _CommandMessage.Propertys.Add(new PropertyShadow(2, 4)); UIObjects.Add(_CommandMessage); LoadData(); }
public SceneSkill() { InitializeComponent(); _Skills = new SkillBase[] { new SkillSprint(3000, Sec(0.7F), 0, 6000, true), new SkillShield(1, 6000, 0, Sec(2F), Sec(3F)), new SkillShockwave(6000, 0, Sec(1.5F), Sec(2.5F), Sec(0.1F), 4000, 300), new SkillBulletTime(2000, 9000, -1, Sec(3), 1), new SkillBait(6000, Sec(2F), Sec(2F), 400), new SkillShotgun(5, 1, 60, 5000, Sec(1F)) //new SkillSleep(3000,Sec(0.5F),Sec(0.5F)) }; if (DeveloperOptions.Player_NoCast) { foreach (SkillBase skill in _Skills) { skill.CostEnergy = 0; skill.CostEnergyPerSec = 0; } } if (DeveloperOptions.Player_NoCooldown) { foreach (SkillBase skill in _Skills) { skill.Cooldown.Limit = 0; } } int len = _Skills.Length; _UISkillIcons = new ObjectUI[len]; _UISkillInfos = new ObjectUI[len]; for (int i = 0; i < len; i++) { int left = i % 2 * 270 + 30; int top = i / 2 * 100 + 120; DrawBase skillDraw = _Skills[i].GetDrawObject(Color.FromArgb(120, 60, 0)); DrawUISkillFrame drawFrame = new DrawUISkillFrame(Color.White, Color.FromArgb(210, 180, 50), 2, 10, SkillKeyType.None, skillDraw) { StaticMode = true }; _UISkillIcons[i] = new ObjectUI(left, top, 75, 75, drawFrame); _UISkillIcons[i].GetFocus += (s, e) => { (s as ObjectUI).DrawObject.Colors.SetColor("Border", Color.Chocolate); (s as ObjectUI).DrawObject.Scale = 1.1F; }; _UISkillIcons[i].LostFocus += (s, e) => { (s as ObjectUI).DrawObject.Colors.SetColor("Border", Color.FromArgb(210, 180, 50)); (s as ObjectUI).DrawObject.Scale = 1F; }; _UISkillIcons[i].Click += IconClick; DrawBase infoDraw = _Skills[i].GetInfoObject(Color.Chocolate, Color.Cornsilk, Color.FromArgb(180, 210, 180, 50)); _UISkillInfos[i] = new ObjectUI(left + 85, top + 6, 170, 75, infoDraw); _UISkillIcons[i].Propertys.Add(new PropertyShadow(4, 6, 1, 1, 0.2F) { RFix = -0.3F, GFix = -0.3F, BFix = -0.3F }); if (GlobalScenes.ChoiceSkill1 != null && _Skills[i].ID == GlobalScenes.ChoiceSkill1.ID) { Skill1 = drawFrame; drawFrame.DrawButton = SkillKeyType.MouseButtonLeft; } else if (GlobalScenes.ChoiceSkill2 != null && _Skills[i].ID == GlobalScenes.ChoiceSkill2.ID) { Skill2 = drawFrame; drawFrame.DrawButton = SkillKeyType.MouseButtonRight; } UIObjects.Add(_UISkillIcons[i]); UIObjects.Add(_UISkillInfos[i]); } DrawUIText drawCommandOK = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "繼續", Global.CommandFont, GlobalFormat.MiddleCenter); DrawUIText drawCommandCancel = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "返回", Global.CommandFont, GlobalFormat.MiddleCenter); DrawUIText drawCommandOKHover = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "繼續", Global.CommandFont, GlobalFormat.MiddleCenter); DrawUIText drawCommandCancelHover = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "返回", Global.CommandFont, GlobalFormat.MiddleCenter); _UICommandOK = new ObjectUI(0, 0, 150, 50, drawCommandOK); _UICommandCancel = new ObjectUI(0, 0, 150, 50, drawCommandCancel); _UICommandOK.DrawObjectHover = drawCommandOKHover; _UICommandCancel.DrawObjectHover = drawCommandCancelHover; _UICommandOK.Propertys.Add(new PropertyShadow(-4, 4) { RFix = 0, GFix = 0, BFix = 0 }); _UICommandCancel.Propertys.Add(new PropertyShadow(4, 4) { RFix = 0, GFix = 0, BFix = 0 }); UIObjects.Add(_UICommandOK); UIObjects.Add(_UICommandCancel); _UICommandOK.Click += (x, e) => { GlobalScenes.ChoiceSkill1 = Skill1 == null ? null : (Skill1.DrawObjectInside as DrawSkillBase).BindingSkill; GlobalScenes.ChoiceSkill2 = Skill2 == null ? null : (Skill2.DrawObjectInside as DrawSkillBase).BindingSkill; SceneGaming scene = GlobalScenes.ChoiceScene.CreateScene(GlobalScenes.ChoiceLevel); OnGoScene(scene); }; _UICommandCancel.Click += (x, e) => { OnGoScene(new SceneMain() { }); }; }
public void setObject(UIObjects obj) { if (!obj.isCollector) gameObject.SetActive(true); selectedObj = obj; objName = obj.transform.parent.name; category = obj.transform.parent.parent.name; }
public ObjectUISceneChoice(int x, int y, int width, int height) : base(x, y, width, height, new DrawBrush(Color.White, ShapeType.Rectangle)) { BackObjects = new ObjectCollection(); var ScenesItems = GlobalScenes.Scenes.GetItems(); int group1Idx = 0; int group1Cot = ScenesItems.Count; _UIScenes = new ObjectUISceneInfo[group1Cot]; _UIScenesLocation = new PointF[group1Cot]; foreach (ISceneInfo sceneInfo in ScenesItems) { _UIScenes[group1Idx] = new ObjectUISceneInfo(DirectionType.TopLeft, 0, 0, new MoveStraight(this, 1, 3000, 1, 100, 1F)); _UIScenes[group1Idx].MoveObject.Target.Anchor = DirectionType.TopLeft; _UIScenes[group1Idx].MoveObject.Anchor = DirectionType.TopLeft; _UIScenes[group1Idx].Layout.Depend.Anchor = DirectionType.TopLeft; _UIScenes[group1Idx].Layout.Depend.SetObject(this); _UIScenes[group1Idx].BindingScene = sceneInfo; _UIScenes[group1Idx].SceneChoice += (s, i, l) => { OnSceneChoice(i, l); }; _UIScenes[group1Idx].HightScoreClick += (s, i) => { OnSceneHightScoreClick(sceneInfo); }; UIObjects.Add(_UIScenes[group1Idx]); group1Idx++; } if (group1Cot > 0) { int maxH = (int)((width - _PaddingX * 2 + _ItemPaddingX) / (_UIScenes[0].Layout.RectWidth + _ItemPaddingX)); // 橫向最多項目數 int cotX = group1Cot > maxH ? maxH : group1Cot; // 橫向數量 int cotY = (group1Cot - 1) / maxH + 1; // 縱向數量 float baseX = (width - (_UIScenes[0].Layout.RectWidth * cotX) - (_ItemPaddingX * (cotX - 1))) / 2; float baseY = _PaddingY + (height - (_UIScenes[0].Layout.RectWidth * cotY) - (_ItemPaddingY * (cotY - 1))) / 2; baseY = Math.Max(_ItemMinY, baseY); float originX = baseX; for (int i = 0; i < _UIScenes.Length; i++) { _UIScenesLocation[i] = new PointF(baseX, baseY); _UIScenes[i].Layout.X = baseX; _UIScenes[i].Layout.Y = baseY + height; _UIScenes[i].MoveObject.Target.SetOffsetByXY(baseX, baseY + height); if (i > 0 && i - 1 % cotX == 0) { baseX = originX; baseY += _UIScenes[0].Layout.RectHeight + _ItemPaddingY; } else { baseX += _UIScenes[i].Layout.RectWidth + _ItemPaddingX; } } } _DrawGroup1 = new DrawUIText(Color.DarkSlateBlue, Color.White, Color.AliceBlue, Color.DarkSlateBlue, 2, 12, "生存100秒", new Font("標楷體", 18, FontStyle.Bold), GlobalFormat.BottomCenter); _DrawGroup1.DrawObjectInside = new DrawSceneTypeA(Color.LightSteelBlue); _UIGroup1 = new ObjectUI(DirectionType.Center, -200, height / 2, 200, 200, _DrawGroup1, new MoveStraight(this, 1, 3000, 1, 100, 1F)); _UIGroup1.Propertys.Add(new PropertyShadow(3, 4)); _UIGroup1.Layout.Depend.Anchor = DirectionType.TopLeft; _UIGroup1.Layout.Depend.SetObject(this); _UIGroup1.GetFocus += (s, e) => { _DrawGroup1.Colors.SetColor("Back", Color.FromArgb(255, 255, 220)); _DrawGroup1.DrawObjectInside.Colors.SetColor("Player", Color.Black); _DrawGroup1.DrawObjectInside.Colors.SetColor("Ememy", Color.Red); }; _UIGroup1.LostFocus += (s, e) => { _DrawGroup1.Colors.SetColor("Back", Color.AliceBlue); _DrawGroup1.DrawObjectInside.Colors.SetColor("Player", Color.LightSteelBlue); _DrawGroup1.DrawObjectInside.Colors.SetColor("Ememy", Color.LightSteelBlue); }; _UIGroup1.Click += (s, e) => { Mode = 1; }; _DrawGroup2 = new DrawUIText(Color.DarkSlateBlue, Color.White, Color.WhiteSmoke, Color.DarkSlateBlue, 2, 12, "", new Font("標楷體", 18), GlobalFormat.BottomCenter); _UIGroup2 = new ObjectUI(DirectionType.Center, width + 200, height / 2, 200, 200, _DrawGroup2, new MoveStraight(this, 1, 3000, 1, 100, 1F)); _UIGroup2.Propertys.Add(new PropertyShadow(-3, 4)); _UIGroup2.Layout.Depend.Anchor = DirectionType.TopLeft; _UIGroup2.Layout.Depend.SetObject(this); _CommandBack = new ObjectUI(20, 20, 80, 40, new DrawUIText(Color.Black, Color.Gray, Color.FromArgb(255, 255, 255, 220), Color.Black, 1, 8, "返回", new Font("微軟正黑體", 18), GlobalFormat.MiddleCenter)); _CommandBack.Propertys.Add(new PropertyShadow(5, 4) { RFix = 0F, GFix = 0F, BFix = 0F }); _CommandBack.Layout.Depend.Anchor = DirectionType.TopLeft; _CommandBack.Layout.Depend.SetObject(this); _CommandBack.Visible = false; _CommandBack.Click += (s, e) => { Mode = 0; }; UIObjects.Add(_CommandBack); UIObjects.Add(_UIGroup1); UIObjects.Add(_UIGroup2); Mode = 0; }
public ObjectUINameSetting(DirectionType anchor, int x, int y, MoveBase moveObject) : base(anchor, x, y, 310, 125, new DrawUIFrame(Color.AliceBlue, Color.CornflowerBlue, 2, 20), moveObject) { Propertys.Add(new PropertyShadow(0, 6, 0.95F, 1)); // 玩家姓名 _DrawPlayerName = new DrawUITextScroll(Color.Maroon, Color.LightGray, Color.FromArgb(230, 255, 245), Color.CornflowerBlue, 1, 10, GlobalPlayer.PlayerName, new Font("細明體", 12), GlobalFormat.MiddleLeft, 120) { TextPadding = new Padding(10, 10, 0, 5) }; ObjectUI uiPlayerName = new ObjectUI(20, 60, 270, 40, _DrawPlayerName); // 重新選取 DrawUIText drawCommandBuildName = new DrawUIText(Color.CornflowerBlue, Color.Empty, Color.Empty, Color.Empty, 0, 0, "↻", new Font("標楷體", 22, FontStyle.Bold), GlobalFormat.MiddleCenter) { TextPadding = new Padding(0, 10, 0, 0) }; DrawUIText drawCommandBuildNameHover = new DrawUIText(Color.Orange, Color.Empty, Color.Empty, Color.Empty, 0, 0, "↻", new Font("標楷體", 22, FontStyle.Bold), GlobalFormat.MiddleCenter) { TextPadding = new Padding(0, 10, 0, 0) }; ObjectUI uiCommandBuildName = new ObjectUI(250, 60, 40, 40, drawCommandBuildName) { DrawObjectHover = drawCommandBuildNameHover }; DrawUIText drawCommandOK = new DrawUIText(Color.FromArgb(100, 220, 100), Color.Empty, Color.Empty, Color.Empty, 0, 0, "✔", new Font("微軟正黑體", 16, FontStyle.Bold), GlobalFormat.MiddleCenter); DrawUIText drawCommandOKHover = new DrawUIText(Color.FromArgb(0, 180, 0), Color.Empty, Color.Empty, Color.Empty, 0, 0, "✔", new Font("微軟正黑體", 16, FontStyle.Bold), GlobalFormat.MiddleCenter); _CommandOK = new ObjectUI(230, 15, 30, 30, drawCommandOK) { Visible = false, DrawObjectHover = drawCommandOKHover }; _CommandOK.Propertys.Add(new PropertyShadow(2, 2) { RFix = -0.5F, GFix = -0.5F, BFix = -0.5F, Opacity = 0.2F }); DrawUIText drawCommandClose = new DrawUIText(Color.FromArgb(255, 150, 150), Color.Empty, Color.Empty, Color.Empty, 0, 0, "✘", new Font("微軟正黑體", 16, FontStyle.Bold), GlobalFormat.MiddleCenter); DrawUIText drawCommandCloseHover = new DrawUIText(Color.FromArgb(255, 70, 70), Color.Empty, Color.Empty, Color.Empty, 0, 0, "✘", new Font("微軟正黑體", 16, FontStyle.Bold), GlobalFormat.MiddleCenter); _CommandClose = new ObjectUI(260, 15, 30, 30, drawCommandClose) { Visible = !string.IsNullOrWhiteSpace(GlobalPlayer.PlayerName), DrawObjectHover = drawCommandCloseHover }; _CommandClose.Propertys.Add(new PropertyShadow(2, 2) { RFix = -0.5F, GFix = -0.5F, BFix = -0.5F, Opacity = 0.2F }); uiPlayerName.Layout.Depend.Anchor = DirectionType.TopLeft; uiCommandBuildName.Layout.Depend.Anchor = DirectionType.TopLeft; _CommandOK.Layout.Depend.Anchor = DirectionType.TopLeft; _CommandClose.Layout.Depend.Anchor = DirectionType.TopLeft; uiCommandBuildName.Layout.Depend.SetObject(this); uiPlayerName.Layout.Depend.SetObject(this); _CommandOK.Layout.Depend.SetObject(this); _CommandClose.Layout.Depend.SetObject(this); uiCommandBuildName.Click += (s, e) => { _DrawPlayerName.Text = Function.GetRandName(); _CommandOK.Visible = true; }; _CommandOK.Click += (s, e) => { GlobalPlayer.PlayerName = _DrawPlayerName.Text; GlobalPlayer.WriteRegistry(); OnClose(); }; _CommandClose.Click += (s, e) => { OnClose(); }; UIObjects.Add(uiPlayerName); UIObjects.Add(uiCommandBuildName); UIObjects.Add(_CommandOK); UIObjects.Add(_CommandClose); }