123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using DragonBones;
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using System.Xml;
- using System.Text;
- using System.Collections;
- using System.Diagnostics;
- using System.Collections.Generic;
- using Transform = UnityEngine.Transform;
- public class ManaPlayer : Regist
- {
- #region 变量
- public static bool Complete;
- public static string SelePlayer = "PlayerBlond";
- public static Transform SeleTra;
- public static Player Player;
- public static Transform PlayerPink;
- public static Transform PlayerBlond;
- public static Transform PlayerBrown;
- public static ManaPlayer Instance;
- #endregion
- public static void Reload()
- {
- ManaReso.TraDic.Remove("Player");
- ManaReso.Save(Player);
- Instance.GetPlayer();
- ManaReso.Get<HudTarget>("C_MiniGame").PosTra = Player.ChildDic["EnterGameTra"];
- }
- public override void Instantiate()
- {
- if (!Complete)
- {
- UnityFactory.factory.LoadDragonBonesData(ManaReso.Load<TextAsset>("stand_ske", Folder.Config));
- UnityFactory.factory.LoadDragonBonesData(ManaReso.Load<TextAsset>("Closet_ske", Folder.Config));
- UnityFactory.factory.LoadTextureAtlasData(ManaReso.Load<TextAsset>("stand_tex", Folder.Config), "stand_texture");
- UnityFactory.factory.LoadTextureAtlasData(ManaReso.Load<TextAsset>("Closet_tex", Folder.Config), "Closet_texture");
- Complete = true;
- }
- if (!ManaTutorial.TutorialA || ManaTutorial.TutorialIndexA != 1)
- {
- SelePlayer = ManaData.GetPlayerString("Player");
- GetPlayer();
- }
- else
- {
- PlayerPink = ManaReso.Get("Player", Folder.Scene, false, ManaReso.Get("PlayerPos3"), false, ObjType.PlayerPink);
- PlayerBlond = ManaReso.Get("Player", Folder.Scene, false, ManaReso.Get("PlayerPos2"), false, ObjType.PlayerBlond);
- PlayerBrown = ManaReso.Get("Player", Folder.Scene, false, ManaReso.Get("PlayerPos1"), false, ObjType.PlayerBrown);
- if (PlayerPink.GetComponent<Player>() == null)
- {
- PlayerPink.AddScript<Player>().BuildPink();
- }
- if (PlayerBlond.GetComponent<Player>() == null)
- {
- PlayerBlond.AddScript<Player>().BuildBlond();
- }
- if (PlayerBrown.GetComponent<Player>() == null)
- {
- PlayerBrown.AddScript<Player>().BuildBrown();
- }
- PlayerPink.localScale = new Vector3(0.8f, 0.8f, 0.8f);
- PlayerBlond.localScale = new Vector3(0.8f, 0.8f, 0.8f);
- PlayerBrown.localScale = new Vector3(0.8f, 0.8f, 0.8f);
- SelePlayer = "PlayerBlond";
- SeleTra = PlayerBlond;
- }
- }
- public override void RegistValueA()
- {
- Instance = this;
- }
- public void GetPlayer(string type = null)
- {
- string player;
- if (type == null)
- {
- player = ManaData.GetPlayerString("Player");
- }
- else
- {
- player = type;
- }
- Transform tra = ManaReso.Get("Player", Folder.Scene, false, transform, ManaReso.Get("PlayerPosTra").position, player.ToEnum<ObjType>());
- Player = tra.GetComponent<Player>();
- if (Player == null)
- {
- Player = tra.AddScript<Player>();
- if (player == "PlayerPink")
- {
- Player.BuildPink();
- }
- else if (player == "PlayerBlond")
- {
- Player.BuildBlond();
- }
- else if (player == "PlayerBrown")
- {
- Player.BuildBrown();
- }
- }
- Player.SetAllCollider(true);
- tra.localScale = new Vector3(0.5f, 0.5f, 0.5f);
- ManaReso.TraDic.Add(tra.name, tra);
- }
- }
|