Esempio n. 1
0
        //バイナリ読み込み
        public void OnRead(BinaryReader reader)
        {
            this.ClearSub();
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader, engine);
                    selections.Add(selection);
                }
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader, engine);
                    spriteSelections.Add(selection);
                    AddSpriteClickEvent(selection);
                }
            }
            else if (version == VERSION_0)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader, engine);
                    selections.Add(selection);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 選択肢追加
        /// </summary>
        /// <param name="label">ジャンプ先のラベル</param>
        /// <param name="name">クリックを有効にするオブジェクト名</param>
        /// <param name="isPolygon">ポリゴンコライダーを使うか</param>
        /// <param name="exp">選択時に実行する演算式</param>
        public void AddSelectionClick(string label, string name, bool isPolygon, ExpressionParser exp, StringGridRow row)
        {
            AdvSelection select = new AdvSelection(label, name, isPolygon, exp, row);

            spriteSelections.Add(select);
            AddSpriteClickEvent(select);
        }
Esempio n. 3
0
        //リストビューのアイテムが作成されるときに呼ばれるコールバック
        protected virtual void CallbackCreateItem(GameObject go, int index)
        {
            AdvSelection     data      = SelectionManager.Selections[index];
            AdvUguiSelection selection = go.GetComponentInChildren <AdvUguiSelection>();

            selection.Init(data, OnTap);
        }
 public void AddData(AdvSelection selection)
 {
     if ((selection.Label != "Alaways") && !this.Check(selection))
     {
         this.dataList.Add(new AdvSelectedHistoryData(selection));
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 初期化
        /// </summary>
        /// <param name="data">選択肢データ</param>
        public virtual void Init(AdvSelection data, Action <AdvUguiSelection> ButtonClickedEvent)
        {
            this.data      = data;
            this.text.text = data.Text;

            UnityEngine.UI.Button button = this.GetComponent <UnityEngine.UI.Button> ();
            button.onClick.AddListener(() => ButtonClickedEvent(this));
        }
Esempio n. 6
0
            public bool Check(AdvSelection selection)
            {
                if (!string.IsNullOrEmpty(this.Label) || !string.IsNullOrEmpty(selection.Label))
                {
                    return(this.Label == selection.Label);
                }

                return((this.Text == selection.Text) && (this.JumpLabel == selection.JumpLabel));
            }
		/// <summary>
		/// 初期化
		/// </summary>
		/// <param name="data">選択肢データ</param>
		public void Init(AdvSelection data, Action<AdvUguiSelection> ButtonClickedEvent)
		{
			this.data = data;
			this.text.text = data.Text;
		//	Debug.Log (data.Text);

			UnityEngine.UI.Button button = this.GetComponent<UnityEngine.UI.Button> ();
			button.onClick.AddListener( ()=>ButtonClickedEvent(this) );

		}
Esempio n. 8
0
        /// <summary>
        /// 既読チェック
        /// </summary>
        public bool Check(AdvSelection selection)
        {
            //選択済みにしない
            if (selection.Label == Ignore)
            {
                return(false);
            }

            return(dataList.Find(x => x.Check(selection)) != null);
        }
Esempio n. 9
0
 /// <summary>
 /// 選択肢データをクリア
 /// </summary>
 public void Clear()
 {
     isWaitSelect = false;
     selected     = null;
     selections.Clear();
     foreach (AdvSelection selection in spriteSelections)
     {
         Engine.GraphicManager.RemoveClickEvent(selection.SpriteName);
     }
     spriteSelections.Clear();
 }
Esempio n. 10
0
 void ClearSub()
 {
     selected = null;
     selections.Clear();
     foreach (AdvSelection selection in spriteSelections)
     {
         Engine.GraphicManager.RemoveClickEvent(selection.SpriteName);
     }
     spriteSelections.Clear();
     IsShowing   = false;
     IsWaitInput = false;
 }
Esempio n. 11
0
        /// <summary>
        /// 選択
        /// </summary>
        /// <param name="selected">選んだ選択肢</param>
        public virtual void Select(AdvSelection selected)
        {
            this.selected = selected;

            string label = selected.JumpLabel;

            if (selected.Exp != null)
            {
                Engine.Param.CalcExpression(selected.Exp);
            }
            this.OnSelected.Invoke(this);
            Engine.SystemSaveData.SelectionData.AddData(selected);
            Clear();
            Engine.ScenarioPlayer.MainThread.JumpManager.RegistoreLabel(label);
        }
Esempio n. 12
0
        /// <summary>
        /// 「選択済み」のデータ追加
        /// </summary>
        public void AddData(AdvSelection selection)
        {
            //選択済みにしない
            if (selection.Label == Ignore)
            {
                return;
            }

            //既に選択済みなのでそのまま
            if (Check(selection))
            {
                return;
            }

            dataList.Add(new AdvSelectedHistoryData(selection));
        }
Esempio n. 13
0
 //コマンド終了待ち
 public override bool Wait(AdvEngine engine)
 {
     if (!engine.SelectionManager.IsWaitSelect)
     {
         AdvSelection selected = engine.SelectionManager.Selected;
         string       label    = selected.JumpLabel;
         if (selected.Exp != null)
         {
             engine.Param.CalcExpression(selected.Exp);
         }
         engine.SelectionManager.Clear();
         engine.JumpScenario(label);
     }
     //JumpScenarioした場合でも常にtrueを返すのが必須
     return(true);
 }
Esempio n. 14
0
 //コマンド終了待ち
 public override bool Wait(AdvEngine engine)
 {
     if (engine.SelectionManager.IsSelected)
     {
         AdvSelection selected = engine.SelectionManager.Selected;
         string       label    = selected.JumpLabel;
         if (selected.Exp != null)
         {
             engine.Param.CalcExpression(selected.Exp);
         }
         engine.SelectionManager.Clear();
         engine.ScenarioPlayer.JumpManager.RegistoreLabel(label);
         return(false);
     }
     return(true);
 }
Esempio n. 15
0
        //バイナリ読み込み
        void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                this.Clear();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader);
                    selections.Add(selection);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Esempio n. 16
0
        //選択肢表示に使うプレハブを取得
        protected virtual GameObject GetPrefab(AdvSelection selectionData)
        {
            GameObject prefab = null;

            if (!string.IsNullOrEmpty(selectionData.PrefabName))
            {
                //プレハブ名と一致するものを探す
                prefab = PrefabList.Find(x => x.name == selectionData.PrefabName);
                if (prefab != null)
                {
                    return(prefab);
                }
                else
                {
                    //見つからないとき
                    Debug.LogError("Not found Selection Prefab : " + selectionData.PrefabName);
                }
            }

            //プレハブ名の指定がなかったら、リストの一番目を
            //旧バージョンとの互換性のためListViewから選ぶ
            prefab = PrefabList.Count > 0 ? PrefabList[0] : ListView.ItemPrefab;
            return(prefab);
        }
		void OnSpriteClick(BaseEventData eventData, AdvSelection select)
		{
			Select(select);
		}
		/// <summary>
		/// 選択肢データをクリア
		/// </summary>
		public void Clear()
		{
			isWaitSelect = false;
			selected = null;
			selections.Clear();
			foreach (AdvSelection selection in spriteSelections)
			{
				Engine.GraphicManager.RemoveClickEvent(selection.SpriteName);
			}
			spriteSelections.Clear();
		}
		//バイナリ読み込み
		void Read(BinaryReader reader)
		{
			this.Clear();
			int version = reader.ReadInt32();
			if (version == VERSION)
			{
				int count = reader.ReadInt32();
				for (int i = 0; i < count; i++)
				{
					AdvSelection selection = new AdvSelection(reader, engine);
					selections.Add(selection);
				}
				count = reader.ReadInt32();
				for (int i = 0; i < count; i++)
				{
					AdvSelection selection = new AdvSelection(reader, engine);
					spriteSelections.Add(selection);
					AddSpriteClickEvent(selection);
				}
			}
			else if (version == VERSION_0)
			{
				int count = reader.ReadInt32();
				for (int i = 0; i < count; i++)
				{
					AdvSelection selection = new AdvSelection(reader, engine);
					selections.Add(selection);
				}
			}
			else
			{
				Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
			}
		}
		void AddSpriteClickEvent(AdvSelection select)
		{
			Engine.GraphicManager.AddClickEvent(select.SpriteName, select.IsPolygon, select.RowData, (eventData) => OnSpriteClick(eventData, select));
		}
Esempio n. 21
0
 /// <summary>
 /// 選択
 /// </summary>
 /// <param name="index">選択肢のインデックス</param>
 public void Select(int index)
 {
     selected     = selections[index];
     isWaitSelect = false;
 }
		/// <summary>
		/// 選択肢追加
		/// </summary>
		/// <param name="label">ジャンプ先のラベル</param>
		/// <param name="name">クリックを有効にするオブジェクト名</param>
		/// <param name="isPolygon">ポリゴンコライダーを使うか</param>
		/// <param name="exp">選択時に実行する演算式</param>
		public void AddSelectionClick(string label, string name, bool isPolygon, ExpressionParser exp, StringGridRow row)
		{
			AdvSelection select = new AdvSelection(label, name, isPolygon, exp, row);
			spriteSelections.Add(select);
			AddSpriteClickEvent(select);
		}
 public bool Check(AdvSelection selection)
 {
Esempio n. 24
0
 public AdvSelectedHistoryData(AdvSelection selection)
 {
     this.Label     = selection.Label;
     this.Text      = selection.Text;
     this.JumpLabel = selection.JumpLabel;
 }
Esempio n. 25
0
 public void Init(AdvSelection data, Action <AdvUguiSelection> ButtonClickedEvent)
 {
Esempio n. 26
0
 /// <summary>
 /// 選択肢データをクリア
 /// </summary>
 public void Clear()
 {
     isWaitSelect = false;
     selected     = null;
     selections.Clear();
 }
Esempio n. 27
0
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="data">選択肢データ</param>
 public void Init(AdvSelection data)
 {
     text.text = data.Text;
 }
Esempio n. 28
0
 private GameObject GetPrefab(AdvSelection selectionData)
 {
		/// <summary>
		/// 選択の入力待ち開始
		/// </summary>
		public void StartWaiting()
		{
			isWaitSelect = true;
			selected = null;
		}
Esempio n. 30
0
        private void CallbackCreateItem(GameObject go, int index)
        {
            AdvSelection data = this.SelectionManager.Selections[index];

            go.GetComponentInChildren <AdvUguiSelection>().Init(data, new Action <AdvUguiSelection>(this.OnTap));
        }
Esempio n. 31
0
 void AddSpriteClickEvent(AdvSelection select)
 {
     Engine.GraphicManager.AddClickEvent(select.SpriteName, select.IsPolygon, select.RowData, (eventData) => OnSpriteClick(eventData, select));
 }
Esempio n. 32
0
 void OnSpriteClick(BaseEventData eventData, AdvSelection select)
 {
     Select(select);
 }
Esempio n. 33
0
 /// <summary>
 /// 選択の表示
 /// </summary>
 public void Show()
 {
     selected  = null;
     IsShowing = true;
     OnBeginShow.Invoke(this);
 }
Esempio n. 34
0
 /// <summary>
 /// 選択の入力待ち開始
 /// </summary>
 public void StartWaiting()
 {
     isWaitSelect = true;
     selected     = null;
 }
		/// <summary>
		/// 選択
		/// </summary>
		/// <param name="selected">選んだ選択肢</param>
		public void Select( AdvSelection selected)
		{
			this.selected = selected;
			isWaitSelect = false;
		}
Esempio n. 36
0
 /// <summary>
 /// 選択
 /// </summary>
 /// <param name="selected">選んだ選択肢</param>
 public void Select(AdvSelection selected)
 {
     this.selected = selected;
     isWaitSelect  = false;
 }
		/// <summary>
		/// 初期化
		/// </summary>
		/// <param name="data">選択肢データ</param>
		public void Init(AdvSelection data)
		{
			text.text = data.Text;
		}