parent
							
								
									ff7ca6cc0f
								
							
						
					
					
						commit
						0eee56f66c
					
				
					 1 changed files with 21 additions and 14 deletions
				
			
		| 
						 | 
					@ -56,7 +56,7 @@ impl ILabel for ScramblingText {
 | 
				
			||||||
         if property == StringName::from("scrambling") {
 | 
					         if property == StringName::from("scrambling") {
 | 
				
			||||||
            let boolean_value = value.booleanize();
 | 
					            let boolean_value = value.booleanize();
 | 
				
			||||||
            let original_text = self.original_text.clone();
 | 
					            let original_text = self.original_text.clone();
 | 
				
			||||||
            if !boolean_value && !self.infinite {
 | 
					            if !boolean_value {
 | 
				
			||||||
                Self::set_text(self, GString::from(original_text.unwrap_or("Hello World!".to_string())));
 | 
					                Self::set_text(self, GString::from(original_text.unwrap_or("Hello World!".to_string())));
 | 
				
			||||||
                self.step_iterator = 0;
 | 
					                self.step_iterator = 0;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -67,6 +67,12 @@ impl ILabel for ScramblingText {
 | 
				
			||||||
            self.step_iterator = 0;
 | 
					            self.step_iterator = 0;
 | 
				
			||||||
            return false
 | 
					            return false
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					         else if property == StringName::from("text") {
 | 
				
			||||||
 | 
					            self.original_text = Some(value.to_string());
 | 
				
			||||||
 | 
					            return false
 | 
				
			||||||
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         else {
 | 
					         else {
 | 
				
			||||||
            return false
 | 
					            return false
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
| 
						 | 
					@ -81,6 +87,7 @@ impl ILabel for ScramblingText {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //TODO: THIS IS RETARDED:::::: PLEASE FIX BRUHHH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn process(&mut self, delta: f64) {
 | 
					    fn process(&mut self, delta: f64) {
 | 
				
			||||||
        if self.scrambling {
 | 
					        if self.scrambling {
 | 
				
			||||||
| 
						 | 
					@ -93,30 +100,30 @@ impl ILabel for ScramblingText {
 | 
				
			||||||
            self.time_since_scramble += delta;
 | 
					            self.time_since_scramble += delta;
 | 
				
			||||||
            self.time_since_step += delta;
 | 
					            self.time_since_step += delta;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            if self.time_since_scramble > duration / speed && self.time_since_step < duration {
 | 
					            if !self.infinite && self.time_since_step >= duration {
 | 
				
			||||||
 | 
					                godot_print!("{}", original_text);
 | 
				
			||||||
 | 
					                self.time_since_step = 0.0;
 | 
				
			||||||
 | 
					                self.step_iterator += 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if self.time_since_scramble >= duration / speed {
 | 
				
			||||||
                self.time_since_scramble = 0.0;
 | 
					                self.time_since_scramble = 0.0;
 | 
				
			||||||
                let chars = self.chars.to_string();
 | 
					                let chars = self.chars.to_string();
 | 
				
			||||||
                let forbidden_chars = self.forbidden_chars.clone().unwrap();
 | 
					                let forbidden_chars = self.forbidden_chars.clone().unwrap();
 | 
				
			||||||
 | 
					 | 
				
			||||||
                let left = Self::slice_left(original_text.clone(), self.step_iterator);
 | 
					                let left = Self::slice_left(original_text.clone(), self.step_iterator);
 | 
				
			||||||
                let right = Self::slice_right(original_text.clone(), self.step_iterator);
 | 
					                let right = Self::slice_right(original_text.clone(), self.step_iterator);
 | 
				
			||||||
 | 
					 | 
				
			||||||
                // if cfg!(debug_assertions) {
 | 
					 | 
				
			||||||
                //     godot_print!("'{}'{}'", left.clone(), right.clone());
 | 
					 | 
				
			||||||
                // }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                self.base_mut().set_text(GString::from(String::from(left + &Self::get_glitch_text(right, chars, forbidden_chars))));
 | 
					                self.base_mut().set_text(GString::from(String::from(left + &Self::get_glitch_text(right, chars, forbidden_chars))));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else if self.time_since_step > duration && self.step_iterator < original_text.chars().count() as i32 {
 | 
					
 | 
				
			||||||
                if !self.infinite | !self.editor_hint {
 | 
					            if original_text.len() as i32 <= self.step_iterator {
 | 
				
			||||||
                    self.step_iterator += 1;
 | 
					                self.time_since_scramble = 0.0;
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                self.time_since_step = 0.0;
 | 
					                self.time_since_step = 0.0;
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if !self.infinite && self.step_iterator >= original_text.chars().count() as i32 {
 | 
					 | 
				
			||||||
                self.step_iterator = 0;
 | 
					                self.step_iterator = 0;
 | 
				
			||||||
                self.scrambling = false;
 | 
					                self.scrambling = false;
 | 
				
			||||||
 | 
					                self.base_mut().set_text(GString::from(original_text));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue