123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using com.workman.cm3d2.scene.dailyEtc;
- using UnityEngine;
- public class UserEditAPI
- {
- public List<SceneEdit.SMenuItem> GetMenu(MPN mpn)
- {
- return this.m_listHead;
- }
- public bool FirstMan()
- {
- return this.m_bFirstMan;
- }
- public void Init(MonoBehaviour f_parent, UserEditAPI.dgOnCharaLoadedCallBack f_dgLoadedFinish)
- {
- Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
- string a;
- if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneUserEdit" && tag_backup.ContainsKey("second"))
- {
- this.m_bFirstMan = false;
- }
- this.m_dgLoadFinish = f_dgLoadedFinish;
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel();
- GameMain.Instance.MainLight.Reset();
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.08306749f, 1.299064f, 0.0249091f), true);
- GameMain.Instance.MainCamera.SetDistance(2.2f, true);
- GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(177.9044f, 2.546583f), true);
- GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 3f * 2f - (float)Screen.width / 2f, 0f, 0f), false);
- GameMain.Instance.SoundMgr.PlayBGM("BGM009.ogg", 0.5f, true);
- if (GameMain.Instance.CharacterMgr.status.isDaytime)
- {
- GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg);
- }
- else
- {
- GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg);
- }
- string[] menuFiles = GameUty.MenuFiles;
- this.m_listHead.Clear();
- foreach (string text in menuFiles)
- {
- if (text.ToLower().Contains("mhead"))
- {
- SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem();
- if (SceneEdit.GetMenuItemSetUP(smenuItem, text, true))
- {
- if (smenuItem.m_boDelOnly)
- {
- }
- if (!(smenuItem.m_texIcon == null))
- {
- if (smenuItem.m_bMan)
- {
- if (smenuItem.m_mpn == MPN.head)
- {
- this.m_listHead.Add(smenuItem);
- }
- }
- }
- }
- }
- }
- GameMain.Instance.CharacterMgr.DeactivateCharaAll();
- this.m_man = GameMain.Instance.CharacterMgr.GetMan(0);
- this.m_man.Visible = true;
- this.m_man.AllProcPropSeqStart();
- f_parent.StartCoroutine(this.CoCharaLoad());
- }
- private IEnumerator CoCharaLoad()
- {
- while (GameMain.Instance.CharacterMgr.IsBusy())
- {
- yield return null;
- }
- GameMain.Instance.CharacterMgr.ResetCharaPosAll();
- this.m_man.body0.SetChinkoVisible(false);
- this.m_man.CrossFade("man_porse01.anm", false, true, false, 0f, 1f);
- GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color));
- if (this.m_dgLoadFinish != null)
- {
- this.m_dgLoadFinish();
- }
- yield break;
- }
- public void Uninit()
- {
- if (GameMain.Instance.MainCamera != null)
- {
- GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
- }
- foreach (SceneEdit.SMenuItem smenuItem in this.m_listHead)
- {
- UnityEngine.Object.Destroy(smenuItem.m_texIcon);
- UnityEngine.Object.Destroy(smenuItem.m_texIconRandomColor);
- }
- this.m_listHead.Clear();
- if (this.m_man != null)
- {
- this.m_man.body0.SetChinkoVisible(true);
- this.m_man.Visible = false;
- }
- }
- public void EndNextScene(CameraMain.dgOnCompleteFade f_dgEnd)
- {
- GameMain.Instance.MainCamera.FadeOut(1f, false, f_dgEnd, true, default(Color));
- }
- public void SetName(string f_strName)
- {
- if (this.m_man == null)
- {
- return;
- }
- GameMain.Instance.CharacterMgr.status.playerName = f_strName;
- }
- public string GetName()
- {
- if (this.m_man == null)
- {
- return string.Empty;
- }
- return GameMain.Instance.CharacterMgr.status.playerName;
- }
- public void SetFat(float f_fRate)
- {
- if (this.m_man == null)
- {
- return;
- }
- MaidProp prop = this.m_man.GetProp(MPN.Hara);
- int val = (int)((float)prop.min + (float)(prop.max - prop.min) * f_fRate + 0.5f);
- this.m_man.SetProp(MPN.Hara, val, false);
- this.m_man.AllProcProp();
- }
- public float GetFat()
- {
- if (this.m_man == null)
- {
- return 0f;
- }
- MaidProp prop = this.m_man.GetProp(MPN.Hara);
- return (float)(prop.value - prop.min) / (float)(prop.max - prop.min);
- }
- public void SetColor(Color f_col)
- {
- if (this.m_man == null)
- {
- return;
- }
- this.m_man.ManColor = f_col;
- this.m_man.ManColorUpdate();
- }
- public Color GetColor()
- {
- if (this.m_man == null)
- {
- return Color.black;
- }
- return this.m_man.ManColor;
- }
- public bool IsSelected(MPN f_mpn, SceneEdit.SMenuItem f_menu)
- {
- if (this.m_man == null)
- {
- return false;
- }
- MaidProp prop = this.m_man.GetProp(f_mpn);
- return prop.nFileNameRID == f_menu.m_nMenuFileRID;
- }
- public void ProcMenu(SceneEdit.SMenuItem f_menu)
- {
- if (this.m_man == null)
- {
- return;
- }
- this.m_man.SetProp(f_menu.m_mpn, f_menu.m_strMenuFileName, f_menu.m_nMenuFileRID, false, false);
- this.m_man.AllProcProp();
- }
- private Maid m_man;
- private List<SceneEdit.SMenuItem> m_listHead = new List<SceneEdit.SMenuItem>();
- private UserEditAPI.dgOnCharaLoadedCallBack m_dgLoadFinish;
- private bool m_bFirstMan = true;
- public delegate void dgOnCharaLoadedCallBack();
- }
|