- 
                Notifications
    
You must be signed in to change notification settings  - Fork 12
 
Add Visual Novel Example to Example branch #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            Crystalwarrior
  wants to merge
  15
  commits into
  AnidemDex:examples
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Crystalwarrior:examples
  
      
      
   
  
    
  
  
  
 
  
      
    base: examples
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Draft
                    Changes from 6 commits
      Commits
    
    
            Show all changes
          
          
            15 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      2f867ec
              
                Make initial example
              
              
                AnidemDex 67c517c
              
                Add a Visual Novel example, with log, skipping, text memory and backg…
              
              
                Crystalwarrior 899bbea
              
                Add a test timeline
              
              
                Crystalwarrior c58f20e
              
                Add hard-coded transitions system for character portraits. This will …
              
              
                Crystalwarrior 9766f9b
              
                Merge commit '6ffdc38d8ebbb024407f3dd8ee64d6916c944c69' into examples
              
              
                Crystalwarrior d563612
              
                Add talk animation support
              
              
                Crystalwarrior c9fae46
              
                Restore .gdignore
              
              
                Crystalwarrior 0f8b111
              
                I screwed up and had the GDIgnore in the wrong folder, oops
              
              
                Crystalwarrior 17d71bc
              
                Optimize all Godette assets using PNGGauntlet (https://pnggauntlet.com/)
              
              
                Crystalwarrior a9ca1d2
              
                Replace mp3 tracks with more compressed ogg files to reduce filesize
              
              
                Crystalwarrior eb93b03
              
                Add a crossfade to the music player
              
              
                Crystalwarrior 495e88d
              
                Add change background, play music and screenshake events
              
              
                Crystalwarrior 2e10b0c
              
                Merge commit 'a68796d11aa80b4f882618ae430c37e7f6a04b21' into examples
              
              
                Crystalwarrior 516c4bb
              
                fix diff commit header
              
              
                Crystalwarrior 3a1fded
              
                Misc maintenance
              
              
                Crystalwarrior File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              Empty file.
          
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  examples/VisualNovel/Backgrounds/backgroundColorForest.png.import
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| [remap] | ||
| 
     | 
||
| importer="texture" | ||
| type="StreamTexture" | ||
| path="res://.import/backgroundColorForest.png-381303fc1ed84ef726ff9947fb369f53.stex" | ||
| metadata={ | ||
| "vram_texture": false | ||
| } | ||
| 
     | 
||
| [deps] | ||
| 
     | 
||
| source_file="res://examples/VisualNovel/Backgrounds/backgroundColorForest.png" | ||
| dest_files=[ "res://.import/backgroundColorForest.png-381303fc1ed84ef726ff9947fb369f53.stex" ] | ||
| 
     | 
||
| [params] | ||
| 
     | 
||
| compress/mode=0 | ||
| compress/lossy_quality=0.7 | ||
| compress/hdr_mode=0 | ||
| compress/bptc_ldr=0 | ||
| compress/normal_map=0 | ||
| flags/repeat=0 | ||
| flags/filter=true | ||
| flags/mipmaps=false | ||
| flags/anisotropic=false | ||
| flags/srgb=2 | ||
| process/fix_alpha_border=true | ||
| process/premult_alpha=false | ||
| process/HDR_as_SRGB=false | ||
| process/invert_color=false | ||
| process/normal_map_invert_y=false | ||
| stream=false | ||
| size_limit=0 | ||
| detect_3d=false | ||
| svg/scale=1.0 | 
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  examples/VisualNovel/Backgrounds/backgroundColorGrass.png.import
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| [remap] | ||
| 
     | 
||
| importer="texture" | ||
| type="StreamTexture" | ||
| path="res://.import/backgroundColorGrass.png-593b0d7eb6130ce55ca13af8b367d76d.stex" | ||
| metadata={ | ||
| "vram_texture": false | ||
| } | ||
| 
     | 
||
| [deps] | ||
| 
     | 
||
| source_file="res://examples/VisualNovel/Backgrounds/backgroundColorGrass.png" | ||
| dest_files=[ "res://.import/backgroundColorGrass.png-593b0d7eb6130ce55ca13af8b367d76d.stex" ] | ||
| 
     | 
||
| [params] | ||
| 
     | 
||
| compress/mode=0 | ||
| compress/lossy_quality=0.7 | ||
| compress/hdr_mode=0 | ||
| compress/bptc_ldr=0 | ||
| compress/normal_map=0 | ||
| flags/repeat=0 | ||
| flags/filter=true | ||
| flags/mipmaps=false | ||
| flags/anisotropic=false | ||
| flags/srgb=2 | ||
| process/fix_alpha_border=true | ||
| process/premult_alpha=false | ||
| process/HDR_as_SRGB=false | ||
| process/invert_color=false | ||
| process/normal_map_invert_y=false | ||
| stream=false | ||
| size_limit=0 | ||
| detect_3d=false | ||
| svg/scale=1.0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| extends Control | ||
| 
     | 
||
| 
     | 
||
| export var main_node: NodePath | ||
| export var expression_player: NodePath | ||
| export var talk_player: NodePath | ||
| 
     | 
||
| var texture | ||
| 
     | 
||
| func _ready(): | ||
| set_size(get_node(main_node).get_rect().size) | ||
| if is_connected("resized", self, "_on_resized"): | ||
| return | ||
| connect("resized", self, "_on_resized") | ||
| 
     | 
||
| 
     | 
||
| func _on_resized(): | ||
| if not main_node: | ||
| push_warning("Main Node not defined on %" % self) | ||
| return | ||
| var node = get_node(main_node) | ||
| var size = node.get_rect().size | ||
| node.set_scale(Vector2(rect_size.y/size.y, rect_size.y/size.y)) | ||
| node.position.x = (rect_size.x - size.x*node.scale.x)/2 | ||
| 
     | 
||
| 
     | 
||
| func change_expression(expression: String): | ||
| if not expression_player: | ||
| push_warning("Expression Player not defined on %" % self) | ||
| return | ||
| var anim_player = get_node(expression_player) | ||
| anim_player.play(expression) | ||
| 
     | 
||
| 
     | 
||
| func set_talk(toggle: bool): | ||
| if not talk_player: | ||
| push_warning("Talk Player not defined on %" % self) | ||
| return | ||
| var anim_player = get_node(talk_player) | ||
| if toggle: | ||
| anim_player.play("talk") | ||
| else: | ||
| anim_player.play("RESET") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| [gd_scene format=2] | ||
| 
     | 
||
| [node name="DialogPiece" type="PanelContainer"] | ||
| margin_right = 1024.0 | ||
| margin_bottom = 78.0 | ||
| __meta__ = { | ||
| "_edit_use_anchors_": false | ||
| } | ||
| 
     | 
||
| [node name="HBoxContainer" type="HBoxContainer" parent="."] | ||
| margin_left = 7.0 | ||
| margin_top = 7.0 | ||
| margin_right = 1017.0 | ||
| margin_bottom = 71.0 | ||
| 
     | 
||
| [node name="Avatar" type="TextureRect" parent="HBoxContainer"] | ||
| margin_right = 64.0 | ||
| margin_bottom = 64.0 | ||
| rect_min_size = Vector2( 64, 64 ) | ||
| expand = true | ||
| 
     | 
||
| [node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] | ||
| margin_left = 68.0 | ||
| margin_right = 1010.0 | ||
| margin_bottom = 64.0 | ||
| size_flags_horizontal = 3 | ||
| 
     | 
||
| [node name="Name" type="Label" parent="HBoxContainer/VBoxContainer"] | ||
| margin_right = 942.0 | ||
| margin_bottom = 14.0 | ||
| text = "Character Name" | ||
| 
     | 
||
| [node name="Dialog" type="RichTextLabel" parent="HBoxContainer/VBoxContainer"] | ||
| margin_top = 18.0 | ||
| margin_right = 942.0 | ||
| margin_bottom = 64.0 | ||
| size_flags_horizontal = 3 | ||
| size_flags_vertical = 3 | ||
| text = "Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text Text text text " | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| extends Control | ||
| 
     | 
||
| 
     | 
||
| var piece_res = preload("res://examples/VisualNovel/DialogPiece.tscn") | ||
| 
     | 
||
| onready var scroll_container = $LogLayout/ScrollContainer | ||
| onready var piece_container = $LogLayout/ScrollContainer/PieceContainer | ||
| onready var log_layout = $LogLayout | ||
| 
     | 
||
| export var duplicate_logging: bool = true | ||
| 
     | 
||
| func clear(): | ||
| for piece in piece_container.get_children(): | ||
| piece.queue_free() | ||
| 
     | 
||
| 
     | 
||
| func add_piece(icon: Texture, showname: String, text: String): | ||
| if not duplicate_logging: | ||
| for piece in piece_container.get_children(): | ||
| var piece_name = piece.get_node("HBoxContainer/VBoxContainer/Name").text | ||
| var piece_dialog = piece.get_node("HBoxContainer/VBoxContainer/Dialog").text | ||
| if showname == piece_name and text == piece_dialog: | ||
| # This is a duplicate - don't bother logging it | ||
| return | ||
| 
     | 
||
| var piece: Control = piece_res.instance() | ||
| piece.get_node("HBoxContainer/Avatar").texture = icon | ||
| piece.get_node("HBoxContainer/VBoxContainer/Name").text = showname | ||
| piece.get_node("HBoxContainer/VBoxContainer/Dialog").text = text | ||
| piece_container.add_child(piece) | ||
| yield(get_tree(), "idle_frame") | ||
| scroll_container.ensure_control_visible(piece) | ||
| 
     | 
||
| 
     | 
||
| func filter_pieces(search: String): | ||
| for piece in piece_container.get_children(): | ||
| var piece_name = piece.get_node("HBoxContainer/VBoxContainer/Name").text | ||
| var piece_dialog = piece.get_node("HBoxContainer/VBoxContainer/Dialog").text | ||
| 
     | 
||
| piece.set_visible(false) | ||
| if search == "" or piece_name.to_lower().find(search.to_lower()) != -1 \ | ||
| or piece_dialog.to_lower().find(search.to_lower()) != -1: | ||
| piece.set_visible(true) | ||
| 
     | 
||
| 
     | 
||
| func _on_SearchString_text_changed(new_text: String): | ||
| filter_pieces(new_text) | ||
| 
     | 
||
| 
     | 
||
| func _on_Button_pressed(): | ||
| log_layout.set_visible(not log_layout.visible) | ||
| if log_layout.visible: | ||
| yield(get_tree(), "idle_frame") | ||
| scroll_container.scroll_vertical = scroll_container.get_v_scrollbar().max_value | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| [gd_scene load_steps=2 format=2] | ||
| 
     | 
||
| [ext_resource path="res://examples/VisualNovel/ICLogs.gd" type="Script" id=2] | ||
| 
     | 
||
| [node name="ICLogs" type="Control"] | ||
| anchor_right = 1.0 | ||
| anchor_bottom = 1.0 | ||
| mouse_filter = 2 | ||
| script = ExtResource( 2 ) | ||
| __meta__ = { | ||
| "_edit_lock_": true, | ||
| "_edit_use_anchors_": false | ||
| } | ||
| 
     | 
||
| [node name="LogLayout" type="Control" parent="."] | ||
| visible = false | ||
| anchor_right = 1.0 | ||
| anchor_bottom = 1.0 | ||
| __meta__ = { | ||
| "_edit_use_anchors_": false | ||
| } | ||
| 
     | 
||
| [node name="Fade" type="ColorRect" parent="LogLayout"] | ||
| anchor_right = 1.0 | ||
| anchor_bottom = 1.0 | ||
| size_flags_horizontal = 3 | ||
| size_flags_vertical = 3 | ||
| color = Color( 0, 0, 0, 0.294118 ) | ||
| __meta__ = { | ||
| "_edit_use_anchors_": false | ||
| } | ||
| 
     | 
||
| [node name="ScrollContainer" type="ScrollContainer" parent="LogLayout"] | ||
| anchor_left = 0.207031 | ||
| anchor_top = 0.0716667 | ||
| anchor_right = 0.792969 | ||
| anchor_bottom = 1.0 | ||
| follow_focus = true | ||
| scroll_horizontal_enabled = false | ||
| __meta__ = { | ||
| "_edit_use_anchors_": true | ||
| } | ||
| 
     | 
||
| [node name="PieceContainer" type="VBoxContainer" parent="LogLayout/ScrollContainer"] | ||
| margin_right = 600.0 | ||
| margin_bottom = 557.0 | ||
| size_flags_horizontal = 3 | ||
| size_flags_vertical = 3 | ||
| __meta__ = { | ||
| "_edit_use_anchors_": true | ||
| } | ||
| 
     | 
||
| [node name="SearchString" type="LineEdit" parent="LogLayout"] | ||
| anchor_left = 0.207 | ||
| anchor_right = 0.793 | ||
| margin_left = 0.0319824 | ||
| margin_right = -0.0320435 | ||
| margin_bottom = 27.0 | ||
| focus_mode = 1 | ||
| size_flags_horizontal = 3 | ||
| __meta__ = { | ||
| "_edit_use_anchors_": false | ||
| } | ||
| 
     | 
||
| [node name="Button" type="Button" parent="."] | ||
| anchor_left = 1.0 | ||
| anchor_right = 1.0 | ||
| margin_left = -95.0 | ||
| margin_top = 10.0 | ||
| margin_right = -14.0 | ||
| margin_bottom = 43.0 | ||
| focus_mode = 0 | ||
| text = "Logs" | ||
| __meta__ = { | ||
| "_edit_use_anchors_": false | ||
| } | ||
| 
     | 
||
| [connection signal="text_changed" from="LogLayout/SearchString" to="." method="_on_SearchString_text_changed"] | ||
| [connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.